Velocity of a node relative to the node.
Posted: Sun May 28, 2006 11:48 pm
I have a node moving at a velocity, The problem is that velocity is in world coordinates I would like it relative to the ship as if the ship were at the origin(0,0,0) below is what I have tried to do but its not quite right yet:
Code: Select all
vector3df getRelativeVel(IAnimatedMeshSceneNode myNode, vector3df worldVel)
{
matrix4 m = new matrix4();
m->setRotationDegrees(myNode.getRotation());
worldVel+=myNode.getAbsolutePosition();
m->inverseRotateVect(worldVel);
return worldVel;
}