3
\$\begingroup\$

I want to take a vector that is using world coordinates and position it using the orientation of an object. So, if the direction of the object is the z-axis, and the vector is (0,0,1), then the orientated vector would point in the direction of the object. I want to vector to remain in the world coordinate system. All I have for the object is it's up and direction vector. So, I can build a matrix with those by crossing them to create the third axis. Multiplying the vector by this matrix transform the vector into the object coordinate system (right?). But, I want the vector in world coordinate system. Should I use the matrix to find euler angles and then use those angles to create a rotation matrix?

\$\endgroup\$
  • 1
    \$\begingroup\$ Multiplying the vector by the matrix should give you the vectors orientation in world space \$\endgroup\$ – CiscoIPPhone Dec 1 '10 at 14:38
  • \$\begingroup\$ When I did what CiscolPPhone suggested, it was the opposite transform. So, I took the inverse of the matrix and that worked. I'm not sure why though. \$\endgroup\$ – zooropa Dec 1 '10 at 16:16
  • \$\begingroup\$ @CiscoIPPhone, any reason that your comment wasn't an answer? That way zooropa here could mark it as accepted. \$\endgroup\$ – Tetrad Dec 1 '10 at 16:19
  • \$\begingroup\$ I'll add it as a answer. \$\endgroup\$ – CiscoIPPhone Dec 1 '10 at 17:07
3
\$\begingroup\$

Multiplying the vector by the matrix should give you the vectors orientation in world space. If this isn't the case then it could be that you are building the transformation matrix incorrectly.

\$\endgroup\$
4
\$\begingroup\$

In addition to what CiscolPPhone said, make sure that you are crossing properly. Dir X Up != Up X Dir. To get the third vector properly, you must first know the handedness of the co-ordinate system. Is it right handed, then it should be Up X Dir and for left handed it should be Dir X Up.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.