I'm working with some 3D graphics and I encountered a problem. I have models that move in a world. The models have a base class that contains their orientation in the form of three orthogonal unit vectors namely Direction, Up, and Right. They point to where the front of the model is directed, the up and the right directions respectively.
The AI of a model pursues a target by changing the Direction vector of the model and all other orientation vectors accordingly, so that it simulates that the model is pointing to the target.
I cannot keep track of the angles that the AI changes the orientation vectors by because the AI files were already pre-compiled and I cannot change them. Also, the AI changes the vectors using the position coordinates of the model and the position coordinates of the target.
My question is how can I obtain yaw, pitch and roll from the orientation vectors in order to create a rotation matrix to rotate the whole model in the desired orientation?
Thanks for any help.
[EDIT] Thanks to the given answer I found this:
X Y Z W
- -
Right | Rx Ry Rz Rw |
Up | Ux Uy Uz Uw |
-Forward |-Fx -Fy -Fz -Fw |
Translation | Tx Ty Tz Tw |
- -
This is how the matrix should be set up to obtain the world matrix using the orientation vectors (without scaling: to scale, just create a scale matrix and multiply it by this).
[SOLVED]