Restarting Particle Systems

Problems building or running the engine, queries about how to use features etc.
Post Reply
winegums
Gnoblar
Posts: 19
Joined: Fri Oct 06, 2006 12:25 am

Restarting Particle Systems

Post by winegums »

Hi, I have a particle system in my app. I want to be able to restart the system when a condition is met. short of destroying the system and recreating it, is there a way to do this through the class member functions?
steak
Gnoblar
Posts: 20
Joined: Fri Mar 09, 2007 12:20 am

Post by steak »

You can just disable and then re-enable the particle systems emitter to restart it.

Like this...

Code: Select all

Ogre::ParticleEmitter * em = fire->getEmitter(0);
em->setEnabled(false);
em->setEnabled(true);
where "fire" is a pointer to your Ogre::ParticleSystem object,
that worked for me.
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re:

Post by 123iamking »

steak wrote: Sun Apr 29, 2007 10:28 am You can just disable and then re-enable the particle systems emitter to restart it.
Thanks, it work :) But I wonder if Ogre has a specific method for this - or this already is the proper way to do? Weird that I haven't seen any official example/tutorial about this while this is really essential. Imagine you want to make gun fire effect, blood effect, ect,... you will need this (or is there other way?)
Anyway, as I test in Ogre 2.1, I only need to set to true (no need to set it to false)

Code: Select all

		Ogre::ParticleEmitter * pEm = m_pParticleFx->getEmitter(0);
		//pEm->setEnabled(false);
		pEm->setEnabled(true);
Because even when I let [pEm->setEnabled(false);] execute, it won't make any difference (some may expect this code will stop the previous effect to start a fresh one, but it won't)
Post Reply