Hello guys,
I have a problem in rotating a mesh in my program. I load a mesh and try to rotate it to a destination.
vector - current position
vector - destination position.
I want to know how to calculate the direction(turn left or right) and the amount of rotation from current position to the destination position.
vector3df pos = m_ptrSceneNode->getPosition();
vector3df des(1, 2, 3);
vector3df absDesRot;
pos = des - pos;
absDesRot = pos.getSphericalCoordinateAngles();
Thank you.
Rotate a mesh to a destination
Re: Rotate a mesh to a destination
You need a rotation to take 'pos' to 'des'. Normally this would require a cross product. However, there is a quaternion function to do this. If you need Tait-Bryan (Euler) Angles, get them from the resulting quaternion.
Re: Rotate a mesh to a destination
If this is still needed, I believe arras once released some "space flight" functions that rotated nodes to a certain vector, along with some other space related stuff,
you might want to check those out.
you might want to check those out.