# Combining transformations

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

## Recommended Posts

Hi all, I was wondering if it is possible to do rotations and translation in one matrix ? Example : D3DXMATRIX Rx, Transformed, Translated; D3DXMatrixTranslation( &Translated, m_fWorldXPos, m_fWorldYPos, m_fWorldZPos ); D3DXMatrixRotationX( &Rx, x ); Transformed = Rx * Translated; m_pDevice->SetTransform( D3DTS_WORLD, &Transformed ); Here I translate an objects x,y,z position, it firstly gets rotated on its x-axis and then translated. Just wondered if there is a way of doing this with one function ? Kind regards, Steve

##### Share on other sites
You can do more than that...

You can rotate, translate to a different origin, rotate about that, translate back to some other origin, scale from there... as many operations as you'd like.

To concatenate matrices, just multiply them
A = B * C
or
D3DXMatrixMultiply(&A, &B, &C);

When all you want to do is mix rotation and translation though, it's often easier to just plug the translation into the matrix yourself...

D3DXMatrixRotationYawPitchRoll(&A, y, p, r);
A._41 = translateX;
B._42 = translateY;
C._43 = translateZ;

Many thanks !

Kind regards,
Steve

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 11
• 10
• 9
• 15
• 22