Rotating objects
Hi!
I previously asked about rotating object in Direct3d and I also got some answers which said that should do my matrix calculations in right order... I tried but... Well I didn''t manage to do it... So could somebody please give a simple code example of rotating object (a triangle for example) in different locations. And so that the object rotates around it''s own origo not around the world origo which is my problem.
Any help would be appreciated.
Floru
D3DXMATRIX T,Rx,Ry,Rz;D3DXMatrixRotationZ(&Rz, Roll);D3DXMatrixRotationX(&Rx, Pitch);D3DXMatrixRotationY(&Ry, Yaw);D3DXMatrixTranslation(&T, Pos.x, Pos.y, Pos.z);D3DXMATRIX Transform;D3DXMatrixMultiplication(&Transform, &Rz, &Rx);D3DXMatrixMultiplication(&Transform, &Transform, &Ry);D3DXMatrixMultiplication(&Transform, &Transform, &T);
And there you have it
Of course, if you're really lazy then you can use D3DXMatrixRotationYawPitchRoll() instead of above rotation matrices. It's also a good optimization, although you will probably not notice much difference unless you compute the transformmatrix lots and lots of time during each frame.
Edited by - Spellbound on 3/17/00 6:43:41 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement