Moving objects in Direct3D

Started by
1 comment, last by Andrew1979 13 years, 6 months ago
Hi

I am needing guidance on how to move multiple objects in Direct3D. I can move one but I'm having trouble moving two objects independantly. Some sample code I'm using is below:

D3DXMatrixTranslation(&matrix_Boogle, 0.0, -10.0, 0.0);

renderGameCharacter(d3ddev);
d3ddev->SetTransform(D3DTS_WORLD, &matrix_Boogle);

D3DXMatrixTranslation(&matrix_GameScene, 0.0, 0.0, 0.0);
renderGameScene(d3ddev);
d3ddev->SetTransform(D3DTS_WORLD, &matrix_GameScene);

I am initializing the matrices before use to the identity matrix.

I am wanting to know how to move both meshes independantly of one another.

Any help appreciated, thank you.

Andrew
Advertisement
I don't know how does your renderGameCharacter work but you should try this:

Create matrix -> Set transform -> Render scene

D3DXMatrixTranslation(&matrix_Boogle, 0.0, -10.0, 0.0);
d3ddev->SetTransform(D3DTS_WORLD, &matrix_Boogle);
renderGameCharacter(d3ddev);


D3DXMatrixTranslation(&matrix_GameScene, 0.0, 0.0, 0.0);
d3ddev->SetTransform(D3DTS_WORLD, &matrix_GameScene);
renderGameScene(d3ddev);
Hi

Thank you for that, it works now , I just had it in the wrong order, doh lol..thank you very much.

This topic is closed to new replies.

Advertisement