Public Group

some 3d questions

This topic is 2651 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi
I am trying the grasp some concepts for very long time, but unfortunately the more I read the more confused I get. The following things are very unclear to me :

1) Does 3d rotation order matters? I read that the rotation order matters, but if the object is placed at the world origin then doesn't matter. Is this correct?

2) What does it mean to rotate object around global axis ? And what does it mean to rotate around its local axis?

Say if I have object that I want to rotate 90 degrees around global x, and 90 degrees around global z axis how should i write that code with opengl ?

And same question if I want to rotate the object 90 degrees around its local x axis, and 90 degrees around its local z axis how to write the code ?

Share on other sites

Hi
I am trying the grasp some concepts for very long time, but unfortunately the more I read the more confused I get. The following things are very unclear to me :

1) Does 3d rotation order matters? I read that the rotation order matters, but if the object is placed at the world origin then doesn't matter. Is this correct?

2) What does it mean to rotate object around global axis ? And what does it mean to rotate around its local axis?

Say if I have object that I want to rotate 90 degrees around global x, and 90 degrees around global z axis how should i write that code with opengl ?

And same question if I want to rotate the object 90 degrees around its local x axis, and 90 degrees around its local z axis how to write the code ?

1. Yes it does, rotating first around X then Y gives different effect, than rotating first around Y, then X

2. Usually you have some "world" coodinate system for your game. Global axis the axis of such coordinate system - for example Z axis is vertical. Local axis is the local coordinate system of object. For example, local Z axis of a character may be the "vertical" axis of body (from head to feet). If character is standing, global and local axes coincide, but if character is lying on bed, local Z axis is horisontal.

The old (now deprecated) way to apply rotation in OpenGl is using glRotate* methods. But I'd suggest you to pick some matrix/vector library (you will need it anyways) and use the methods from there.

In most general way, the matrix math behind such transformations is:

Mo' = Mry * Mrx * Mo - rotates object first around global X, then around global Y
Mo' = Mrx * Mry * Mo - rotates object first around global Y, then around global X
Mo' = Mo * Mry * Mrx - rotates object forst around local X, then around (old) local Y
Mo - transformation of your object (local coordinate system)
Mrx - rotation matrix around X axis
Mry -rotation matrix around Y axis
Mo' - new transformed local coordinate system of object

All matrix libraries have some specific methods for doing these elemntary transformations, but the exact syntax varies

1. 1
Rutin
71
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• Forum Statistics

• Total Topics
633428
• Total Posts
3011822
• Who's Online (See full list)

There are no registered users currently online

×