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.
Stop particles emitters
- Praetor
- OGRE Retired Team Member
- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
- Contact:
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Would probably be a good idea to add a convenience function, then?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- Kojack
- OGRE Moderator
- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 534
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.
- 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.
-
- Kobold
- Posts: 39
- Joined: Tue Dec 23, 2008 9:55 pm
- x 5
Re: Stop particles emitters
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
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
-
- Gnoblar
- Posts: 1
- Joined: Thu Nov 14, 2013 7:21 am
- x 1
Re: Stop particles emitters
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
-
- Kobold
- Posts: 39
- Joined: Tue Dec 23, 2008 9:55 pm
- x 5
Re: Stop particles emitters
Thanks SpaceKitty!