Advertisement Jump to content
Sign in to follow this  
xissburg

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Quote:
Original post by Illco
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.

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!