[Matrices] World working, View behaving strangely
Hi,
I've finished setting up a movement control system for a generic 3d entity in 3d space. It simply allows to have a pos[x,y,z] rot[x,y,z] vector and move it around by rotating it and pedaling or backpedaling in the direction it's facing.
(more details here: http://www.gamedev.net/community/forums/post.asp?method=reply&topic_id=515178 )
For each object onscreen, consequently, I've a d3dmatrix that I apply to D3DTS_WORLD before drawing it. It works perfectly and I can fly objects around with perfect control.
But then, when I apply another matrix of the same type to the "camera" by setting D3DTS_VIEW instead (of course before drawing anything), it doesn't behave the same way. The camera doesn't pedal/backpedal properly and I can't even properly describe the way it translates/rotates.
The part of code that finalizes a matrix for a moveable entity looks like this:
// TRANSLATE
D3DXMatrixTranslation(TranMatrix,entity_posx,entity_posy,entity_posz);
// ROTATE USING QUATERNIONS
D3DXQuaternionRotationYawPitchRoll(RotQuat,entity_roty,entity_rotx,entity_rot.z);
D3DXMatrixRotationQuaternion(RotMatrix,RotQuat);
D3DXMatrixMultiply(FullMatrix,RotMatrix,TranMatrix);
Anything utterly wrong here?
Thanks in advance
a.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement