matrix-rotation problem
hi!
i am doing the following:
i have an object, position and orientation are stored
in a translationMatrix and a rotationMatrix. when rendering
the object, i compose a transformationMatrix with them.
now i want to rotate the object around its own z-axis.
i try to do that by multiplying the rotationMatrix with another
rotationMatrix representing a rotation around the z-axis.
but my object rotates around (0/0/0), not the objects position!
i seem to have followed the example i found in the article from
diana gruber, but the effect i get is not the one i wanted ...
what is wrong?

sebastian
i am doing the following:
i have an object, position and orientation are stored
in a translationMatrix and a rotationMatrix. when rendering
the object, i compose a transformationMatrix with them.
now i want to rotate the object around its own z-axis.
i try to do that by multiplying the rotationMatrix with another
rotationMatrix representing a rotation around the z-axis.
but my object rotates around (0/0/0), not the objects position!
i seem to have followed the example i found in the article from
diana gruber, but the effect i get is not the one i wanted ...
what is wrong?

sebastian
You have to rotate your object while it's still centered around the origin, and then translate it.
yeah, reverse the order of the matrix multiplies.
idealy if you're going to have 4 transforms, namely:
Location (translate)
Rotation (around a local origin offset)
Scale (around the same local origin offset)
Origin offset (translate)
you want to use the gl(Scale/Rotate/Translate) in the above order when setting up your matrix. Then just draw your polygons as if unscaled/rotated at the origin.
idealy if you're going to have 4 transforms, namely:
Location (translate)
Rotation (around a local origin offset)
Scale (around the same local origin offset)
Origin offset (translate)
you want to use the gl(Scale/Rotate/Translate) in the above order when setting up your matrix. Then just draw your polygons as if unscaled/rotated at the origin.
---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| 2D OpenGL With SDL Rotation + Scaling Problem | Greywhind | 4 | 3,291 |
Jun 2, 2006 04:16 PM Last Post: Greywhind |
|
| Quaternion rotation -> OpenGL rotation matrix? | DJBlufire | 3 | 3,344 |
Sep 6, 2003 08:34 PM Last Post: MattDiamond |
|

