How do I reuse a particle effect?

Problems building or running the engine, queries about how to use features etc.
Post Reply
Gunblade
Gnoblar
Posts: 4
Joined: Mon Apr 16, 2007 5:17 pm

How do I reuse a particle effect?

Post by Gunblade »

Simple question i think. I lack the information to know how to call it more than once. This code here:

ParticleSystem* windParticle = mSceneMgr->createParticleSystem("Wingtip", "Wingtip");
SceneNode* windParticleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("WindParticle");
windParticleNode->attachObject(windParticle);
windParticleNode->setPosition(0,10,-10);

I call it once and it will stay on screen. but obviously if I was to call this entire code again it would crash as I can have only one instance of windparticle.
Problem is I don't know the code to re use the same particle over and over or the code to remove it off screen and I can't find any help on particles with ogre.Any help would be appreciated thanks.
Ajare
Goblin
Posts: 282
Joined: Sat May 14, 2005 9:20 pm
x 1

Post by Ajare »

You can have more than one instance of a particle system template running at once - just give it a different name.

Code: Select all

ParticleSystem* windParticle = mSceneMgr->createParticleSystem("Wingtip1", "Wingtip");
SceneNode* windParticleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("WindParticle1");
windParticle = mSceneMgr->createParticleSystem("Wingtip2", "Wingtip");
windParticleNode = SceneMgr->getRootSceneNode()->createChildSceneNode("WindParticle2");
You can make particle systems timeout (ie not update) when offscreen with the 'nonvisible_update_timeout' attribute. See the manual. Or you can just destroy the systems with SceneManager::destroyParticleSystem yourself.
Post Reply