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:
my logic is to just set its linear velocity in the direction of its local -z axis is facing every frame.
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.