I'm trying to put together a dog fight space game. The spaceship is a IMeshSceneNode But I'm having some problems with rotating in 3D space relative to the object it self.
I was trying to use the code in this topic
http://irrlicht.sourceforge.net/phpBB2/ ... t=rotation
But unlike the camera, mesh nodes don't have a getTarget() and GetUpVector() . I don't know how to create a relative XYZ space that I can rotate around and keep it locked to the ship as it moves and spins.
Any help would be great thank you.
----
after looking on some forums would this work?
Code: Select all
core::vector3df forward(0, 0, 1);
core::matrix4 m;
m.setRotationDegrees( node->getRotationDegrees() );
// rotate the forward vector into parent coords
m.rotateVect(forward);
// get the old position
core::vector3df position(node->getPosition());
// get the distance moved this time slice
f32 distance = velocity * time;
// augment the node position
position += (forward * distance);
node->setPosition(position);