Hello there!
First of all, thank you for such great 3D library, i really enjoy working with it 
I would like a little help/explanation on this one:
I want to call a callback on my ParticleSystem, when the system animation ends.
Normally, im using ParticleSystem.onAnimationEnd = ()=>{
// Animation ended code here
}
But when Im using ParticleSystem with manualEmitCount, the callback is never called.
Either is it a bug or Im doing something wrong.
Can you please help me on this one?
Here is a playground https://playground.babylonjs.com/#206JUO#23
On line 88 starts callback, works when not using manualEmitCount.
On line 94 starts callback, it doesnt work when using manualEmitCount.
Thank you
Hey @jan-capiak - Welcome to the Babylon Family! We’re super pumped to have you here!
I’m not an expert by any means, but I believe the reason that the onAnimationEnd method isn’t firing for Particle system 1 in your provided playground, is because that particle system isn’t actually stopping. The system itself is still running after it emmits the manually specified number of particles. The particle system needs to have stop() called in order to trigger the onAnimationEnd method.
I’m not really sure this is a bug as you can just query the emmit count before or after the render in order to tell the system to stop?
Check out this playground as an example:
https://playground.babylonjs.com/#206JUO#24
I’ve added lines 103-107 with a function that runs before each rendered frame checking to see if the emmit count is at 0, and when it is, it fires the alert.
Again, I’m not an expert at all. What are your thoughts? Do you think the particle emitters should stop once the system has emitted the specific number of particles? is there a use case where you’d want to continually fire more bursts of particles? Probably? Maybe?
Open to discussion on this, but my guess would be that there are enough cases that we wouldn’t want it to automatically stop.
Anyways…hope this helps a bit
Hello @PirateJC and thank you for the explanation.
Yes it does make sense that the system has to be stopped in order to call onAnimationEnd callback.
My use case was, that i wanted to emit only one Particle at a time.
But when i use ParticleSystem.emitRate = 1, it doesnt produce any particle at all. So i used manualEmitCount in order to show only one particle, but then this problem with onAnimationEnd occured.
Is there another way to emit only one particle with emitRate, or for such a use case it is best to use manualEmitCount?
Thank you