Lets say im sending particles out the tail pipe on a space fighter. Thanks to some help here i got this to work. Now when you turn the ship how do you map the direction the particles are being emmitted to the inverse of the ships heading.
I have the node set to be the child of the ship.
I have set a rotation of the node to the rotation of the ship in the run loop.
MySpaceShip.EngPartNode->setRotation(MySpaceShip.NodeShip->getRotation());
I dont see a command of the type
setParticleEmitterDirection(Node,vector3df());
So this leaves me a bit baffled on how this is going to get done since you drop the emitter after you set it right.
Now particle direction on a dynamic object
irr::scene::SParticle::vector = (vector3df(0,0,-.1)
I was searching in the datafiles and found the struct that holds the emitter direction. I am attempting to alter it in this fashion, and getting the following error.
c:\Game\Code\Spaceflight\spaceflight.cpp(990): error C2597: illegal reference to non-static member 'irr::scene::SParticle::vector'
I tried to get to it with just irr::scene::Sparticle.vector =
That didnt work, im really not sure i can this type of alter on an irr struct.
I was searching in the datafiles and found the struct that holds the emitter direction. I am attempting to alter it in this fashion, and getting the following error.
c:\Game\Code\Spaceflight\spaceflight.cpp(990): error C2597: illegal reference to non-static member 'irr::scene::SParticle::vector'
I tried to get to it with just irr::scene::Sparticle.vector =
That didnt work, im really not sure i can this type of alter on an irr struct.
You're correct, the support is not in, however, I got it to work very easily by modifying the source. It's pretty simple, here's the files you need to update and the updates you need to make to them -
IParticleSystemSceneNode.h
IParticleEmitter.h
CParticlePointEmitter.h
CParticlePointEmitter.cpp
CParticleBoxEmitter.h
CParticleBoxEmitter.cpp
CParticleSystemSceneNode.h
CParticleSystemSceneNode.cpp
In - IParticleSystemSceneNode.h - add :
In - IParticleEmitter.h - add :
In - CParticlePointEmitter.h - add :
In - CParticlePointEmitter.cpp - add :
In - CParticleBoxEmitter.h - add :
In - CParticleBoxEmitter.cpp - add :
In - CParticleSystemSceneNode.h - add :
In - CParticleSystemSceneNode.cpp - add:
If you need me to email you the files, or if you need any help with recompiling the Irrlict code so you can incorporate these changes into your project, let me know.
IParticleSystemSceneNode.h
IParticleEmitter.h
CParticlePointEmitter.h
CParticlePointEmitter.cpp
CParticleBoxEmitter.h
CParticleBoxEmitter.cpp
CParticleSystemSceneNode.h
CParticleSystemSceneNode.cpp
In - IParticleSystemSceneNode.h - add :
Code: Select all
virtual void setDirection(core::vector3df direction) = 0;
Code: Select all
virtual void setDirection(core::vector3df direction) = 0;
Code: Select all
virtual void setDirection(core::vector3df direction);
Code: Select all
void CParticlePointEmitter::setDirection(core::vector3df direction)
{
Direction = direction;
}
Code: Select all
virtual void setDirection(core::vector3df direction);
Code: Select all
void CParticleBoxEmitter::setDirection(core::vector3df direction)
{
Direction = direction;
}
Code: Select all
virtual void setDirection(core::vector3df direction);
Code: Select all
void CParticleSystemSceneNode::setDirection(core::vector3df direction)
{
if ( Emitter )
Emitter->setDirection ( direction );
}
well snaged already. I loaded the source into vs c++ 2003.net and looked over it a bit. I had a thought to try to compile it the way it is now before i go jacking with it.
Ok it compiled first shot I sat shocked almost how well that went, no to test it. I loaded my project and swaped the dll files. I was thinking that now i should be able to see if it works. Ok the exe loaded fine and im off in my game and all is well. But now framerate has dumped from around 78 to 60 fps and the dll is 1.1 meg as the old one was only 880ish. I did a release build without debug info as that build really slows things down and puffs the dll up 2.6 meg.
So not sure if im compiling it correctly or the dll was out of date with the distrubition.
But ill try to roll with this and lookinto it later.
Ok it compiled first shot I sat shocked almost how well that went, no to test it. I loaded my project and swaped the dll files. I was thinking that now i should be able to see if it works. Ok the exe loaded fine and im off in my game and all is well. But now framerate has dumped from around 78 to 60 fps and the dll is 1.1 meg as the old one was only 880ish. I did a release build without debug info as that build really slows things down and puffs the dll up 2.6 meg.
So not sure if im compiling it correctly or the dll was out of date with the distrubition.
But ill try to roll with this and lookinto it later.
Well the intelsense still isnt working in my project on this project thats a bit annoying but the good news is it works. I can set the direction of the particles in the routine where i make the emitter node. Now i just need to assign it to a class link list so i can operate on it in the run loop on different ships at once.
This should be fun.
Just wanted to let you and other know it worked well with this command
EngEmmitter->setDirection(vector3df(0,0.10,-0.06));
EngEmmitter is the pointer
scene::IParticleEmitter* EngEmmitter = MySpaceShip.EngPartNode->createPointEmitter(....options
Thanks for the help and hope others can make use of this. I can see it as a very usefull additions you can have people running around with paticle hair on fire and smoke rolling out of tail pipes or make a guy smoking a pipe with nice smoke coming off it for close in cut scenes.
Now on with the show.
Yokom
This should be fun.
Just wanted to let you and other know it worked well with this command
EngEmmitter->setDirection(vector3df(0,0.10,-0.06));
EngEmmitter is the pointer
scene::IParticleEmitter* EngEmmitter = MySpaceShip.EngPartNode->createPointEmitter(....options
Thanks for the help and hope others can make use of this. I can see it as a very usefull additions you can have people running around with paticle hair on fire and smoke rolling out of tail pipes or make a guy smoking a pipe with nice smoke coming off it for close in cut scenes.
Now on with the show.
Yokom