local axes of bodies

jchmack

02-05-2007 17:30:09

How can i get local axes of a body? Like the axis each body has in the debug overlay. For example if i wanted to get a point 1 unit ahead of a body in its local z axis. The reason i ask is because i'm trying to get my body to move (locally) forward (in the negative z direction) each frame. like a local version of mBody->setLinearVelocity(). Im trying to make an object travel in smooth curves. I want to set its angular velocity then have it move forward based on its local orientation. Ive been trying something like this:


Vector3 CurrentVelocity = (*iter)->mBody->getLinearVelocity();
Quaternion LocalDirection = (*iter)->mBody->getGlobalOrientation();

(*iter)->mBody->setLinearVelocity(LocalDirection * CurrentVelocity);


my logic is to just set its linear velocity in the direction of its local -z axis is facing every frame.

betajaen

02-05-2007 18:12:23

Ogre may have something what your looking for; Something in the Bodies Node may help you.