How can i convert quaternion to vector correctly, i have a robot on terrain which control by player, when robot fire a bullet, robot will pass it's own orientation to bullet class, then bullet will set it's own orientation as robot, now the bullet will fly straight in that direction, but i only can get back quaternion not vector, therefore, i can do like this calculation
Direction*TimeStep*Movement . I found a code can convert quaternion but, it is not work for me. How can i do?
It use quaternion times a vector but my bullet might face any possible direction not just negative z
Code: Select all
Ogre::Quaternion pQuat=quat;
pQuat=pQuat.Inverse();
Ogre::Vector3 pDirection=pQuat*Ogre::Vector3::NEGATIVE_UNIT_Z;
return pDirection;