Getting the Left, Forward and Back vectors from a View Matrix directly
I was wondering why I had to calculate the forward and left vectors for my arcball camera manually and why these results differed from ViewMatrix.Left and the likes. So I asked at the xna forums and almost immediately Jeremy Walsh pointed me in the right direction. He pointed out to me that view matrices are transposed from a normal matrix (meaning that the rows and columns are switched). To get the right vectors from the view matrix, we have to transpose it again to get the original matrix, however this generates a lot of garbage, so he told me that its better to construct the vectors from the matrix cells themselves.
And so I did, and I’ve packaged them into my neat PositionalMath class (which I might release some day). Here are the methods to get all the information you want from those view matrices, without having to calculate the forward (lookat - position) and crossing that.
- roytries
- roy-t
- roytri