Stop particles emitters

What it says on the tin: a place to discuss proposed new features.
Post Reply
bcsanches
Kobold
Posts: 39
Joined: Tue Dec 23, 2008 9:55 pm

Stop particles emitters

Post by bcsanches » Tue Dec 23, 2008 10:19 pm

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.
0 x

User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
Contact:

Post by Praetor » Wed Dec 24, 2008 3:43 am

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.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Post by jacmoe » Wed Dec 24, 2008 3:45 am

Would probably be a good idea to add a convenience function, then? :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7147
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 16

Post by Kojack » Wed Dec 24, 2008 7:46 am

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.
0 x

bcsanches
Kobold
Posts: 39
Joined: Tue Dec 23, 2008 9:55 pm

Re: Stop particles emitters

Post by bcsanches » Wed Dec 24, 2008 2:35 pm

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.

Cheers
Bruno Sanches
0 x

SpaceKitty
Gnoblar
Posts: 1
Joined: Thu Nov 14, 2013 7:21 am

Re: Stop particles emitters

Post by SpaceKitty » Thu Nov 14, 2013 7:27 am

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
0 x

bcsanches
Kobold
Posts: 39
Joined: Tue Dec 23, 2008 9:55 pm

Re: Stop particles emitters

Post by bcsanches » Thu Nov 14, 2013 12:24 pm

Thanks SpaceKitty!
0 x

Post Reply