phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Particle emitter death zones are positioned in global space

Open vforsh opened this issue 1 year ago • 1 comments

Version

Phaser 3.60 beta 18

Description

Emitter death zones are positioned in global space which is unexpected.

Was it an intentional change? It is quite confusing IMO because of the 2 reasons:

  • in prior versions death zones were positioned in emitter local coordinates space
  • emit zones & gravity wells are positioned in local space

Example Test Code

https://codesandbox.io/s/particles-death-zone-qpmvhn

let particles = this.add.particles(300, 300, "flares", {
	lifespan: 1500,
	alpha: { start: 0, end: 1 },
	scale: 0.2,
	quantity: 20,
	emitting: false,
})

// emit zone position is in local emitter space (as expected)
let emitZone = new Phaser.Geom.Circle(0, 0, 200)
particles.addEmitZone({
	source: emitZone,
	type: "random",
	quantity: -1,
})

// deathZone position is in global space
let deathZone = new Phaser.Geom.Circle(0, 0, 100)
// you need to manually calculate the offset to put it in the right place
// let deathZone = new Phaser.Geom.Circle(particles.x, particles.y, 100)
particles.addDeathZone({
	source: deathZone,
	type: "onEnter",
})

particles.start(1500)

vforsh avatar Jan 28 '23 19:01 vforsh

I am having this issue as well. Clearly coordinates should be in emitter-space or this does not work using existing geometries. I am trying to get this to work by passing the center point but this is clearly an unacceptable hack.

Any chance this will be addressed?

claudeduguay avatar Oct 04 '23 23:10 claudeduguay