Jump to content
  • Advertisement


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


Matrices, possible to matrix with two objects , then use one matrix to move them both

This topic is 5279 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 is what i want to do: Say i got 2 meshes, i position them both within a matrix. eg mesh1 = (0,30,10) mesh2 = (50,10,10) once ive used the d3dx matrix code to set them, i then want to move them both together, like if i say (0,0,0) they will be positioned at the positions i showed above, but if i position them at (10,0,0) they would be positioned at (10 ,30,10) and (60 ,10,10). Is this possible using the d3dx matrix functions etc?

Share this post

Link to post
Share on other sites
Try to use D3DXTranslation(&outMat, x, y, z);

So, D3DXMatrixTranslation(&mesh1Position, 10, 0, 0) and D3DXMatrixTranslation(&mesh2Position, 10, 0, 0) for your given example.

Create a D3DXVECTOR3 to hold your point in space.

D3DXVECTOR3 Position;
Position = D3DVECTOR3(0, 0, 0);

D3DXMatrixTranslation(&mesh1Position, Position.x, Position.y, Position.z), etc...


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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!