Jump to content
  • Advertisement
Sign in to follow this  
Vectorg

Object Rotation (off-axis)

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

hi, I'm using a 3x3 rotation matrix to orient an object that rotates on its x, y, and z axes. Now, I want to rotate the same object on a different axis. Instead of rotating the object on its object-space axes, I want to rotate it on a world-space axis. The resulting orientation must be stored in a single 3x3 matrix. How should I go about this? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Build a rotation matrix from an axis angle representation (Google should give that easily) then multiply it with your current rotation matrix. The effect of both rotation will cumulate. The order of the multiplication will define wich of the two matrice is applied first.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks, b34r, that makes sense. I have not worked with axis angle rotations, but I'll give it a try.

Share this post


Link to post
Share on other sites
I would also suggest taking a few hours aside and read about Quaternions.

It is more than likely once you start doing many rotations, and wanting to rotate a model axis given a world axis that you will quickly run into gimble lock.

Solving this problem with Euler rotations will be near impossible, but quiet easy with Quats.

Give them a look.


Share this post


Link to post
Share on other sites
Just wanted to point out that matrices are no more susceptible to gimbal lock than quaternions, so don't let that be a factor in choosing one over the other. (Not contradicting Ham, just clarifying for the OP.)

Share this post


Link to post
Share on other sites
Ham, I'll read about the quaternions. Can you suggest any particularly good sources of info?

Thanks.

Share this post


Link to post
Share on other sites
jyk, I realize you already told me about the axis angle rotations, but I didn't understand it. I'm going to try coding this in a few days and see if I can get it to work.

Thanks for the help.

Share this post


Link to post
Share on other sites
Quote:
Original post by Vectorg
jyk, I realize you already told me about the axis angle rotations, but I didn't understand it. I'm going to try coding this in a few days and see if I can get it to work.

Thanks for the help.


You can find a very friendly explanation here.
And this page will also be of interest I think.

Share this post


Link to post
Share on other sites
I used to have a link to a really good Quat guide but It seems I've lost it.

But a quick search I foudn this article, right off GameDev.net. It seems pretty good.

Read the whole thing, It has infromation that will undoubtedly help later on, if not help solve your current problem.

Share this post


Link to post
Share on other sites
Thanks guys. I found an article on axis angle rotations on euclideanspace.com, and I got it working!

jyk,
I'm using a cross product of the out and up vectors, and a small angle. For any attitude, the nose of the plane drops toward the ground then stops when it's pointing straight down. The cross product changes signs if the nose goes past vertical, and it comes back.

Now to get it working in the flight sim.

Thanks again.

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!