D3DXMatrix MatRot;
D3DXMatrixIdentity(&MatRot);
D3DXMatrixRotationZ(&MatTemp, pObject.zRot);
D3DXMatrixMultiply(&MatRot, &MatRot, &MatTemp);
This wastes time, just do this :
Code:
D3DXMatrixRotationZ(&MatRot,pObject.zRot);
.
.
.
Generally, the code's too slow since it creates a matrix for each axis rotation. You should write a function that creates a rotation matrix directly (without calling D3DX) ( I have one, I'll post it later, cause I don't quite have it right now).
Anyway,
this only causes the entire world to move, however. what am i doing wrong?
You possibly did the following :
1 - You set this rotation matrix as a world matrix
2 - Render your object
3 - Render the rest of the world (with the same matrix set)
which is wrong, If you did this, change it to the following :
1 - Set this rotation matrix as a world matrix
2 - Render your object
3 - Set the world matrix as an identity matrix
4 - Render the rest of the world.
The world matrix you created is specifically created for the object supplied, if you keep it set, it's going to rotate all the other objects too (and thus your world will get moved/rotated)