quote:
"Translate and then rotate" (R * T) = move to a new position and spin.
"Rotate and then translate" (T * R) = an orbitting effect because the object is rotated to a new angle and then moved along that angle.
You have those backwards. When you translate and then rotate, you achieve the effect of moving the object away from the origin, then rotating the object around the world''s origin, not that object''s origin. This is the orbiting effect. FinalMatrix = Scale * Trans * ZRot * YRot * XRot or FinalMatrix = Scale * Trans * XRot * YRot * ZRot (can''t remember off hand on the rotation order).
When you rotate and then translate, you are rotating an object around its origin and then moving the object to the exact position (determing by the translation coordinates) in the world. This is the method used to position meshes in the world. FinalMatrix = Scale * XRot * YRot * ZRot * Trans
Off the top of my head, I think the following will work for you:
// Calculate the rotation matrix of cameraD3DXMATRIX matRotation;D3DXMatrixRotationYawPitchRoll(&matRotation, CameraYRotation, CameraXRotation, CameraZRotation);// Set Speed to speed of camera movement forwardD3DXVECTOR3 vecDir(0.0f, 0.0f, Speed);// Calculate new camera coordinatesD3DXVECTOR3 vecCam;D3DXVec3TransformCoord(&vecCam, &vecDir, &matRotation);CameraXPos += vecCam.x;CameraYPos += vecCam.y;CameraZPos += vecCam.z;
Jim Adams