Object Rotation (off-axis)

Started by
8 comments, last by Vectorg 18 years, 9 months ago
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.
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.
Praise the alternative.
Thanks, b34r, that makes sense. I have not worked with axis angle rotations, but I'll give it a try.
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.


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.)
Ham, I'll read about the quaternions. Can you suggest any particularly good sources of info?

Thanks.
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.
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.
Praise the alternative.
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.

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.

This topic is closed to new replies.

Advertisement