Getting position vector from D3DXMatrix?

Started by
1 comment, last by chillypacman 15 years, 4 months ago
Hi all, How can I get the world position of something from a D3DXMatrix which has rigid transformations applied (position and rotation?) Would this be the correct way, that is, would it work for all possible matrices?

D3DXMatrix m;
 D3DXVector3( m._41, m._42,m._43 );


Thanks for any help! [Edited by - chillypacman on December 18, 2008 6:57:36 AM]
Advertisement
That works for everything except the view matrix. The view matrix is the inverse of the camera's world matrix, so you'd need to do an inverse, then grab the position from 41,42,43 to get a camera's location. It's easier to have your camera class keep both matrices to keep your options open.
Quote:Original post by Namethatnobodyelsetook
That works for everything except the view matrix. The view matrix is the inverse of the camera's world matrix, so you'd need to do an inverse, then grab the position from 41,42,43 to get a camera's location. It's easier to have your camera class keep both matrices to keep your options open.


That's ok, I only needed it to derive the position of something. I thought I knew how to do it but didn't know if it would work all the time (like if a rotation or something was applied to the matrix).

Thanks.

This topic is closed to new replies.

Advertisement