Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Agrajag

Translations in d3d

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

I was wondering how to move only one object at a time in DX. I thought this might work --------------------------------------------------- D3DXMATRIX mat; D3DXMatrixTranslation(&mat, X, Y, 0); // it''s for 2D, so Z isn''t necessary g_pd3dDevice->SetTransform( D3DTS_WORLD, &mat ); ---------------------------------------------------- but this moves all the objects =(. Any help would be great.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
D3DXMATRIX mat, ident;
D3DXMatrixTranslation(&mat, X, Y, 0);
D3DXMatrixIdentity(&ident);

// set world matrix
pd3dDevice->SetTransform(D3DTS_WORLD, &mat);

// draw your object here

// reset world matrix
pd3dDevice->SetTransform(D3DTS_WORLD, &mat);

// draw next thing here


etc...

Share this post


Link to post
Share on other sites
thanks a lot, the only thing is that when you reset the matrix, you use `g_pd3dDevice->SetTransform( D3DTS_WORLD, &ident );` instead of ` &mat ` again.

thanks

Share this post


Link to post
Share on other sites

  • 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!