Matrices extract data very easily. Check the documentation for the function you are using (I used the documentation for D3DXMatrixLookAtLH):
http://msdn.microsoft.com/en-us/library/bb205342%28v=vs.85%29.aspx
As you can see at the bottom of the page, the matrix is ββinternally created as follows:
zaxis = normal(At - Eye) xaxis = normal(cross(Up, zaxis)) yaxis = cross(zaxis, xaxis) xaxis.x yaxis.x zaxis.x 0 xaxis.y yaxis.y zaxis.y 0 xaxis.z yaxis.z zaxis.z 0 -dot(xaxis, eye) -dot(yaxis, eye) -dot(zaxis, eye) 1
Remember that this is true only for DirectX; transpose the above matrix when transferring the same calculations to OpenGL, because the coordinate system in DirectX refers to the norm.
source share