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

Recommended Posts

johnnyBravo    100
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
Supernat02    604
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