Jump to content
  • Advertisement
Sign in to follow this  
perre75

Rotations from direction, up and side vectors

This topic is 3126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently working on a 3d racing game in Direct3D on my spare time. But I have run into some problems regarding the representation of the graphical object from my body class. The car body class has forward, up and side vectors that are perfectly perpedicular to each other. My graphical object however needs yaw pitch roll rotations to be represented correctly. A quaternion could work as well. I'm quite convinced in that there's a quite straight forward solution for this. I would appreciate every help I possibly could get. Thanks in advance. / Per

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by perre75
I'm currently working on a 3d racing game in Direct3D on my spare time. But I have run into some problems regarding the representation of the graphical object from my body class.

The car body class has forward, up and side vectors that are perfectly perpedicular to each other. My graphical object however needs yaw pitch roll rotations to be represented correctly. A quaternion could work as well.

I'm quite convinced in that there's a quite straight forward solution for this. I would appreciate every help I possibly could get.

Thanks in advance.
/ Per
You can get either a quaternion or a set of Euler angles, as needed, by converting the direction vectors to a matrix, and then converting the matrix to a quaternion or Euler-angle triple. (Personally I'd go with a quaternion, if that's an option, as the conversion is less problematic.)

To build a matrix from the direction vectors, simply load the direction vectors into the rows or columns (depending on whether you're using row vectors or column vectors) of the matrix. Which direction vector goes in which row/column will depend on how the object in question is oriented with respect to the cardinal basis vectors in local space.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!