Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a matrix that defines the rotation and translation of an object, relative to (0, 0, 0). Assuming that the identity matrix defines the camera to be at (0, 0, 0) pointing at (0, 0, 1), how would I go about constructing the view matrix from the world + rotation matrix?

share|improve this question
add comment

1 Answer

Assuming I've understood the question correctly, you need to inverse the matrix. The inverse of the matrix is a matrix such that a multiplication between it and the matrix it is an inverse of will result in the identity matrix (i.e. 1,0,0,0 ,0,1,0,0, 0,0,1,0, 0,0,0,1). I'm not sure if you're using Opengl, D3d or whatever but your library should include functions to calculate the inverse. Bear in mind that calculating the inverse is not trivial and shouldn't be done say, once per vertex - you should calculate the inverse of the view matrix only as often as you change the view position. HTH.

share|improve this answer
    
Will this actually give me the view matrix? As in, the matrix required to project world space into camera space? –  rfw May 8 '11 at 2:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.