Translations in d3d
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.
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...
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...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement