Need to know how to rotate a 3d vector

FireSoul

01-08-2006 19:25:31

Hey, I have managed to get rotation and movement sorted out with force call backs now, but one problem remains. I would like to know if there any functions/methods that can be used to change my force vector (forwards force) so that moves the object forwards in the current orientation.

I have had a look at the Quatenion methods and dont really know if it has the methods im looking for. Is there any quick method of multiplying the 3d forward force vector by a 3d/4d matrix which will change the values in the first vector so that the force will always be in the correct direction.

Thanks for any help and replies.

Ryan.

walaber

02-08-2006 06:44:48

1. if you want, just use the "addLocalForce" to add a force in the local space of the body.

2. to rotate a vector just multiply the quaternion by the vector:

Ogre::Vector3 rotated_vector = rotation_quaternion * vector_to_rotate;

FireSoul

02-08-2006 16:18:46

Thanks for the reply, that formula will help a lot now.

Ryan.