# Rotating in a world coordinate system

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

## Recommended Posts

I want to rotate objects using a world coordinate system but I just know how to rotate using the local coordinate system!...damn...how can I do it?

##### Share on other sites
Put simply: first translate the object from local space to world space by applying a translation transform. Then apply the rotation transform. The specified rotation will now not be around the center of the object but around the center of the world. Rotations are always around the world center; it is a matter of translating your object as to what effect to achieve.

Greetz,

Illco

##### Share on other sites
Quote:
 Original post by IllcoPut simply: first translate the object from local space to world space by applying a translation transform. Then apply the rotation transform. The specified rotation will now not be around the center of the object but around the center of the world. Rotations are always around the world center; it is a matter of translating your object as to what effect to achieve.

Note that you don't have to actually transform the object from local space to world space, you can just premultiply the world matrix to your desired rotation matrix:
local_to_world_then_rotate_matrix = local_to_world_matrix * rotation_matrix;

And then use it as a world matrix.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634060
• Total Posts
3015300
×