GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Particle emitter destroyed as having "no particles" if the flow is too small

Open PascalLadalle opened this issue 4 years ago • 2 comments

Setting the flow of particles to small values ends up crashing the emission. Setting the flow to 1 sends a few particles (sometimes two, sometimes a dozen) and then the flow stops (and the last particle disappears). Increasing the flow again doesn't resume it.

game.zip Press Space to lower emission, v to restore.

Expanded from: source

PascalLadalle avatar Jan 31 '22 13:01 PascalLadalle

This happens because the object is configured to be deleted "when it's out of particles", but here it actually should never run out of particles (but I guess it considers it has not even 1 particle, and so stop and gets deleted).

This can be worked around by disabling this option. But this is also a bug that should be fixed I think.

(Just a nitpicking on the naming: this is not a crash, because the game or the editor are not crashing, the game just continues to run.)

4ian avatar Jan 31 '22 13:01 4ian

This bug is due to the fact that the condition uses the method getParticleCount that is misleading: https://github.com/4ian/GDevelop/blob/master/Extensions/ParticleSystem/particleemitterobject.ts#L333-L339

it returns the number of active (displayed) particles and not the number of particles that remains in the tank. And I think that there is no such data in the pixi object: https://pixijs.io/particle-emitter/docs/classes/Emitter.html#particleCount

We could maybe watch _emitterLife to have this piece of information https://pixijs.io/particle-emitter/docs/classes/Emitter.html#_emitterLife

AlexandreSi avatar May 25 '22 11:05 AlexandreSi