Question regarding cameramatrices

Mar 22, 2009 at 4:15 PM

What do they represent? The camera's view matrix, or view*projection?

Coordinator
Mar 22, 2009 at 10:23 PM
Edited Mar 22, 2009 at 10:24 PM
This is one of those things XNA fails to explain properly.
'CameraMatrix' simple represents the world matrix of the camera, just like a model has it's world matrix. So given the matrix representing the head of a character - set CameraMatrix to that, and the camera will be positioned and rotated to match the model's head. :-)

The view matrix is *always* the inverse of the camera matrix. The projection matrix is separate, and generated by the Projection object within 3D cameras.
XNA dances around the relationship between the view matrix and camera matrix, never really detailing how they are related and how they are different. The LookAt() method in XNA, for example, always builds an inverted camera matrix (ie, a view matrix), which makes the method practically useless for things other than cameras (unless you know to invert it).

Hope that helps