# Rotating an object about its center

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

## Recommended Posts

I know DX has a matrixRotationAxis function, but I don't know what to provide as the axis when I want to rotate something about it's center say in the Y direction.

##### Share on other sites
there you have it. Axis is Y, likely Vector(0, 1, 0).

##### Share on other sites
Yes, but that only works if the y parameter of the center is 0.

##### Share on other sites
Not sure if I'm understanding you correctly, but rotation and translation are separate things. The Y axis - any axis - is a normalized vector, which represents direction only, not position. So whether your object is at 0, 0, 0 or 25, 48, 132, the Y axis will still be 0, 1, 0.

You can combine rotation and translation into a 4x4 matrix, but it can also be done separately. If done separately, the order in which you perform the operations will determine the results. In OpenGL, operations occur in the opposite order that they are declared. I don't know how it works in DX.

So in short, try rotating your object around the Y axis, and then translating it. If that doesn't work, try translating it and then rotating it.

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 11
• 13
• 9
• 10
• 12
• ### Forum Statistics

• Total Topics
633003
• Total Posts
3009825
• ### Who's Online (See full list)

There are no registered users currently online

×