Rotation to Direction and Back Again?

Started by
0 comments, last by ajas95 19 years, 5 months ago
I'm wondering if there is anyway I can take a normalized direction vector and somehow get x,y,z rotation information from it? Could I take the direction vector and get a rotation axis and amount of degrees to rotate it? Or could I get amount of degrees to rotate on x, y, and z? Any help is much appreciated!
Advertisement
Well, you can get y-x rotation (yaw, pitch). You can't define a roll for the direction vector unless you also specify an 'up' vector.

The pitch is the acos of the y component of the direction. To get yaw, you zero out that y component and normalize the xz direction vector, then take the acos of the -z component of that vector (assuming that your frame of reference is defined as -z forward, y up and x right).

It's also important to note that the order in which the resulting angles are applied to a vector are important, and must be applied :
yaw * pitch * V

This topic is closed to new replies.

Advertisement