Page 1 of 1

Stop particles emitters

Posted: Tue Dec 23, 2008 10:19 pm
by bcsanches
Hi folks,

I am using Ogre for some time and now I am starting to use the particle systems. On my game here, I attached a particle system to some platforms to simulate fire, but I want to disable it.

The way that I have found was to remove the objectparticle system from the scene node. This works, but the particles simple disappears.

I did a change on Ogre to include a mEmitting boolean variable that I can use to control if the particle system should emit or not the particles. This is cool because this lets the particles disappears during their normal life time.

I am thinking about sending a patch with this change, but I would like to know what the community think about this.

Posted: Wed Dec 24, 2008 3:43 am
by Praetor
This is probably poorly documented. The question comes up a lot. Set the emitter parameter emission_rate to 0 to stop the emitter from emitting new particles. Later, just reset it to its normal value and it will start emitting again.

Posted: Wed Dec 24, 2008 3:45 am
by jacmoe
Would probably be a good idea to add a convenience function, then? :)

Posted: Wed Dec 24, 2008 7:46 am
by Kojack
The problem with using emission rate is that a particle system could:
- have several emitters
- have different emission rates for each emitter

so to turn a system off and on you need to loop through all emitters, save their current values, set them to zero, then later loop through them all and restore the values.
It would be much easier to just have a bool in the particle system or a bool per emitter to turn them on and off without wiping the script defined emission rate.

Re: Stop particles emitters

Posted: Wed Dec 24, 2008 2:35 pm
by bcsanches
I actually used this technique of running across all emitters and setting emission rate for each one to zero. This works, but we need to store this value somewhere and restore it back, this gets a bit complicated when we have several emitters on the same system

if my change, I just added a boolean attribute to the PartycleSystem class and on it main loop, if just checks if it should calls triggerEmitters or not.

Bruno Sanches

Re: Stop particles emitters

Posted: Thu Nov 14, 2013 7:27 am
by SpaceKitty
Incase anyone sees this post now, setEmitting is now a function of particle systems, this can be used to make a particle system start and stop emitting particles without hiding all particles or changing the emission_rate to 0

Re: Stop particles emitters

Posted: Thu Nov 14, 2013 12:24 pm
by bcsanches
Thanks SpaceKitty!