Jump to content
  • Advertisement
Sign in to follow this  
steg

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.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!