Jump to content
• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# How to Rotate 3 axes?

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

In my game, I need to rotate the objects with X, Y, and Z axes, now, I know rotating each axis should have some effect on the other axes but i''m not sure what relationship they have to each other. Does anyone know of a relationship to relate each axis rotation?

#### Share this post

##### Share on other sites
Advertisement
Humm... well, if i get the idea, do not forget that x, y and z axes are perpendicular (90 degrees). Do you know what matrices are ?

Bye

#### Share this post

##### Share on other sites
Is there any way to do it without using matrices?

#### Share this post

##### Share on other sites
Humm...guess yes, but it requires a lot of operations. I extremely recommend you to use matrices. Use google and type this on search "3d matrices tutorials". Good luck.

Bye

#### Share this post

##### Share on other sites
quote:
caffeineaddict
Is there any way to do it without using matrices?

No, not really. You need to store the rotation information with at least a 4 DoF form, and produce a rotation matrix from it, which is applied to the world transform prior to rendering the objects geometry.

In order to allow free rotation about all three axi you need to use a vector & an angle or a quanterion to represent the rotation.

If you use three angles (roll, pitch, & yaw), then you run into a problem known as Gimbal Lock.

There's been some debates about whether a vector & an angle, or a quanterion is better for representing angles. The truth is, they're the same thing - the difference is very similar to the difference between polar coordinates & rectangular. The quanterion is like a 'polar' (spherical) representation of the rotation, and the vector/angle is like a rectangular (cylindrical) representation.

Hopefully, intuition tells you that a spherical representation of a rotation would have certain advantages. A primary advantage of q's is that it's simple mathematics to concatenate rotations together. The disadvantage, is that is takes more calculation to produce a usable rotation matrix from the q (as affine matrix representations are decidedly Euler coordinate (x,y,z)). In different situations each representation can be advantageous.

[edited by - Magmai Kai Holmlor on June 28, 2002 8:26:51 PM]

#### Share this post

##### Share on other sites
maybe read
http://www.gamedev.net/community/forums/topic.asp?topic_id=101785

when you rotate an object, you rotate it around one of its primary axes. ( well, strictly ,not necessarily the case, but lets not confuse the issue )

this means that you set a rotation matrix around the axis, and use the matrix to transform the other two axes.

example: looking up theta degrees.
we set a rotation matrix for theta degrees around the right vector.

then transform the up vector and the lookat vector with this matrix.

making the rotation matrix isn''t that hard. d3dx can do it for you, or 5 mins searching the web will give you a formula.

doing it without matrices would be more difficult than doing it with. (apart from quats - essentially the same thing)

hope this helps.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632983
• Total Posts
3009714
• ### Who's Online (See full list)

There are no registered users currently online

×

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