# mesh movement

## Recommended Posts

alright, so i can get a mesh to move with: g_pd3dDevice->SetTransform(D3DTS_WORLD,&matTransform ); the trouble is, everything is transformed to the same point in the world, and when you move, everything moves with you. how can i make it so only one mesh moves (i.e. the player's mesh) whilst the rest (such as buildings) remain stationary? cheers, Mal'

##### Share on other sites
No idea for the syntax in DirectX but in openGL you push a matrix transform, render the object, pop the transform:

for each object{    glPushMatrix();    //post-multiply the object's own orientation matrix    //render the object    glPopMatrix();}

You'd likely do something similar in DirectX.

-me

##### Share on other sites
yeah, i figured there's gotta be a similar command for DX, but i simply don't know it :P

##### Share on other sites
ah ha!

i think i found the answer to my own question. In the line:
g_pd3dDevice->SetTransform(D3DTS_WORLD,&matTransform );

you set the matrix to apply the transform to, in this case "&matTransform", if i'm right, i can just apply that to a different matrix, for example "&matPlayer" for the player's mesh, or "&matBuilding" for a building somewhere on the level.

i certainly hope this is right ^_^