Sign in to follow this  

Rotations from direction, up and side vectors

This topic is 2846 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
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

This topic is 2846 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this