# 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.

## 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 on other sites
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 on other sites
Thanks, b34r, that makes sense. I have not worked with axis angle rotations, but I'll give it a try.

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

Thanks.

##### 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 on other sites
Quote:
 Original post by Vectorgjyk, 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.

##### 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 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.

1. 1
Rutin
22
2. 2
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633308
• Total Posts
3011294
• ### Who's Online (See full list)

There are no registered users currently online

×