• Advertisement
Sign in to follow this  

Getting position vector from D3DXMatrix?

This topic is 3318 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

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
Sign in to follow this  

  • Advertisement