Sign in to follow this  
chillypacman

Getting position vector from D3DXMatrix?

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this