Skip to main content
gamedev.net
🔒 Locked

Rotation

Started by ridefast42 2 replies 350+ views
Original Post
ridefast42
ridefast42
Using direct3d9, how do you rotate an object about its center rather than the origin of the coordinate plane. As far as I am concerned the matrix transformations only rotate about (0,0,0). This wouldn't be a problem except that I want to be able to draw to certain coordinate and then rotate my object. I do not want to have to draw to the origin,rotate my object,and then translate my object. I am sorry if this is a noob question but I am only up to about lesson 6 on directtutorial.com.Thanks.
grill8
grill8
Hello friend, I hope I can be of help.

Models are most of the time stored in model space (origin centered). Your objects which reference the model store geometric information (rotation/translation etc.). Most often you compose a concatentation matrix which is simply the matrix_rotation * matrix_translation which will then transform your model to the proper position.
There are mathematical simplifications to the matrix multiplication but that is linear algebra. Your models should be stored in model space (origin centered) and your objects which reference the models should store the rotation/translation etc. You then pass this information to the model for rendering.
That is my understanding. Hope that helps.
Jeremy
dave
dave
It depends on the order that the translation and rotation matrices are multiplied into the world matrix.

world = identity;world *= rotation about origin;world *= translation from origin;


That will translate the obejct into position and then rotate it about its origin at the translated position.

Dave
ridefast42
ridefast42
Ya dave, I knew you could do that but it seemed inefficient. Now that grill explained how it works(to my understanding kind of like a pointer) it doesn't seem so inefficient. Thanks for the quick help!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.