Sign in to follow this  

Combining transformations

This topic is 4822 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

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


Link to post
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;

Share this post


Link to post
Share on other sites

This topic is 4822 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this