Jump to content
  • Advertisement
Sign in to follow this  
wpyax

??help about the D3DXMatrixMultiply

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

this's my code. and it don't work as my wish.why? i want to move the object by walk_front and RotationY and D3DXMatrixMultiply(&matWorld1, &matWorld1, &matWorld2); D3DXMatrixMultiply(&matWorld1, &matWorld2, &matWorld1); is different,why? float angle=0.0f; float r=1.0f; D3DXMATRIXA16 matWorld1; D3DXMATRIXA16 matWorld2; D3DXMatrixTranslation( &matWorld1, sinf(angle)*r,0.0f,cosf(angle)*r); D3DXMatrixRotationY(&matWorld2, angle+D3DX_PI); D3DXMatrixMultiply(&matWorld1, &matWorld2, &matWorld1); g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld1 ); . . . . case VK_LEFT: angle-=D3DX_PI/12; if(angle<0) angle+=2*D3DX_PI; break; case VK_RIGHT: angle+=D3DX_PI/12; if(angle>(2*D3DX_PI)) angle=angle-2*D3DX_PI; break; case VK_UP: r+=0.2f; break;

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
RotationMat * TranslationMat is different from TranslationMat * RotationMat.

Think those transformations are applied in sequence. For example:

Suppose a translation in x direction and a rotation of 30 degrees around y axis. Consider your object is initially on the origin.

1) RotationMat * TranslationMat will place the object on the x axis.

2) TranslationMat * RotationMat will not place the object on the x axis (but on a direction at 30 degrees from the x axis).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!