# Combine Rotations

## Recommended Posts

Oliver_zx    518
Hey there, im new to the whole game-math. I got an issue now where you guys will propably be able to help me out. I got a WorldPosition-class which holds the pos-data for my objects in the worldspace. This includes 2 Vector3's for rotation and translation as well as Matrices for rotation/translation. Now i build a hierarchy of such worldposition so any movement/rotation of an object will result in changes of any sub-item. Thus a rotation of an object around its center will lead to a rotation of the subitem around the center of the parentitem. Now to the point..the worldpos-instances generates a matrix or all translations/rotations done to the object. This will used as device.Transform.xx when the item is rendered. Thats the idea but im unable to manage it. I just dont know how to merge the Pivot-Rotation (Move world to inverse of Pivot-Pnt, Rotate, Mode world to Pivot-Pnt again). I mean how can i save the pivot-rotation in one matrix together with the other translations ? Ah well i know its not this good described..i hope you get my point. Thanks alot for the help! oliver

##### Share on other sites
Bob Janova    769
Combining two transformations mean multiplying their transformation matrices together. Depending on whether you're using OpenGL or DirectX (one is row-major and the other column-major), you will either want to multiply 'up the stack' (final matrix = local transform * parent transform * ... * world transform) or 'down the stack' (final matrix = world transform * ... * group transform * leaf transform).

##### Share on other sites
Oliver_zx    518
Quote:
 Original post by Bob JanovaCombining two transformations mean multiplying their transformation matrices together. Depending on whether you're using OpenGL or DirectX (one is row-major and the other column-major), you will either want to multiply 'up the stack' (final matrix = local transform * parent transform * ... * world transform) or 'down the stack' (final matrix = world transform * ... * group transform * leaf transform).

ah ok...thanks for the help. Will try that out...