Partikelsystem "soft" disappear

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
madtulip
Halfling
Posts: 78
Joined: Thu Nov 18, 2004 6:35 pm
Contact:

Partikelsystem "soft" disappear

Post by madtulip » Fri Mar 25, 2005 1:24 pm

im using pixelsystems display the eninges of the rockets i use in my game.

2 questions for that

1) are the positions of the pixels relative to the node of the emission, so that the rocket would always have a "stick" of prixel behind it when it turns. that would not look realistic. or are the positions of the pixels at the moment theiy are emitted not relative to the emmitting node anymore so i can get a effekt like "writing stuff into the air" like you can do with colord smoke from plains or fireworks.what methode is used to change between theese styles, if thats possible

2) what is a good way to turn an partikelsyste "soft" off. if my rockets dies, because of age i simply remove the mesh and nodes for now.

Code: Select all

	if (mfAge < mfRuntime)// this. is aging
	{
		if(mActive == true)
		{
			mfAge += timeSinceLastFrame;// as long as we are processing this, the projectile is still alive
			// move the projectile forward
			Vector3 vec;
			vec = Vector3::ZERO;
			vec.z = mfSpeed * timeSinceLastFrame;
			Vector3 trans = mProjectileNode->getOrientation() * vec;
			mProjectileNode->translate(trans);
		}
	}

	else// this. has to die now, its to old.
	{
		// the last one turns off the light ...
		mSceneMgr->removeLight(mEngineLightName.str());
		ParticleSystemManager::getSingleton().destroySystem(mpSysEngine);

		mProjectileNode->detachObject(mProjectile);// vanish !

		mProjectileNode->removeChild (mEngineEffectsNode);
		mSceneMgr->getRootSceneNode()->removeChild (mProjectileNode);

		// reset
		mActive = false;
		mfAge = 0;
	}
i definitiv need to remove any last one of it in the end. but i would like to do this in 2 phases.

1 rocket is fliing
2 -wait until it has to die because of age-
3 rockets mesh is removed, the movement is stopped,the partikelsystem does not emitt any further partikels
4 -wait until all partikels have disappeared
5 completly remoce the partikelsystem and all the nodes belonging to the rocket

what i got sofar is step 1,2,5

how to get the maximum time the partikels of the system would "survive" if i turn it off now (apart from looking into the skriptfile direct).
and how to tell the system to stop to emitt partiekls now
0 x

madtulip
Halfling
Posts: 78
Joined: Thu Nov 18, 2004 6:35 pm
Contact:

Post by madtulip » Fri Mar 25, 2005 2:22 pm

problem 2) solved

Code: Select all

void CProjectile::Update(float timeSinceLastFrame)
{
	if (mfAge < mfRuntime)// this. is aging
	{
		if(mActive == true)
		{
			mfAge += timeSinceLastFrame;// as long as we are processing this, the projectile is still alive
			// move the projectile forward
			Vector3 vec;
			vec = Vector3::ZERO;
			vec.z = mfSpeed * timeSinceLastFrame;
			Vector3 trans = mProjectileNode->getOrientation() * vec;
			mProjectileNode->translate(trans);
		}
	}

	else// this. has to die now, its to old.
	{
		Real LastPartikelTimeToLive = mpSysEngine->getEmitter(0)->getTimeToLive();

		if (ProjectileHasToDieButPSySIsStillAlive == true)
		{	
			mSceneMgr->removeLight(mEngineLightName.str());
			mpSysEngine->getEmitter(0)->setEmissionRate(0);
			
			mProjectileNode->detachObject(mProjectile);// vanish !

			ProjectileHasToDieButPSySIsStillAlive = false;
		}
		if (mfAge > mfRuntime + LastPartikelTimeToLive)//the last partikel has disappeared
		{
			ParticleSystemManager::getSingleton().destroySystem(mpSysEngine);
			mProjectileNode->removeChild (mEngineEffectsNode);
			mSceneMgr->getRootSceneNode()->removeChild (mProjectileNode);

			// reset
			ProjectileHasToDieButPSySIsStillAlive = true;
			mActive = false;
			mfAge = 0;
		}
	}
}
be carefull not to produce a deadlock with ProjectileHasToDieButPSySIsStillAlive.
0 x

madtulip
Halfling
Posts: 78
Joined: Thu Nov 18, 2004 6:35 pm
Contact:

Post by madtulip » Fri Mar 25, 2005 2:31 pm

1) also solved, the partikels dont move relative to the emitting node
0 x

Post Reply