is there anyway i can have a particle system node following player node while reserving its orientation? like the water splashing underneath a boat when going forward/turning..
thanks a lot
particle node following object
-
Conquistador
- Posts: 340
- Joined: Wed Sep 28, 2005 4:38 pm
- Location: Canada, Eh!
Make the particle system a child of the player node?
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
-
shadowrider
- Posts: 5
- Joined: Tue Jan 31, 2006 5:18 pm
yea that's what i tried before but the particle behaviour was totally out of range/deformed.
this code does it
and i just run it every frame, and it does follow around the character, but the problem is, once the player node rotate and move, the position of the particle is no longer behind the character as it was initialized in the beginning.
is there methods in irrilicht that get the orientation of the node?
then i could just do something like:
ps->setRotation(player->getOrientation);
thanks
this code does it
Code: Select all
IParticleSystemSceneNode* ps;
IParticleEmitter* em;
IParticleAffector* paf,*pgaf;
ISceneNodeAnimator* pkill= smgr->createDeleteAnimator(100);
//int particleCount = 20;
vector3df currPos = node->getPosition();
vector3df newPos (currPos.X,currPos.Y,currPos.Z+20.0f); //behind player
ps = smgr->addParticleSystemSceneNode(false);
//ps->setRotation(vector3df(-90,-100,0));
ps->setPosition(newPos);
ps->setScale(vector3df(1,1,1));
ps->setParticleSize(dimension2d<f32>(9.0f,11.0f));
//em=ps->createPointEmitter(vector3df(0.03f,0.1f,0.03f),3,1,SColor(0,255,250,250),SColor(0,250,250,250),100,200,45);
em=ps->createBoxEmitter(aabbox3d<f32>(-3,0,-3,3,1,3),vector3df(0.0f,0.2f,0.0f),10,30,
SColor(0,255,250,250),SColor(0,255,250,250),100,200,45);
ps->setEmitter(em);
em->drop();
paf = ps->createFadeOutParticleAffector(SColor(0,200,200,200),500);
ps->addAffector(paf);
paf->drop();
pgaf = ps->createGravityAffector(vector3df(0,-0.01f,0));
ps->addAffector(pgaf);
pgaf->drop();
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialTexture(0, driver->getTexture("../../media/smoke.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
ps->setParticlesAreGlobal(false);
ps->addAnimator(pkill);
pkill->drop();is there methods in irrilicht that get the orientation of the node?
then i could just do something like:
ps->setRotation(player->getOrientation);
thanks
-
Conquistador
- Posts: 340
- Joined: Wed Sep 28, 2005 4:38 pm
- Location: Canada, Eh!
Yeah, there is, check out the ISceneNode page in the API. Also, take a look at the vector3d page, specifically the rotation functions.
EDIT: You might also want to try a search, the code might already be out there.
EDIT: You might also want to try a search, the code might already be out there.
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca