Jump to content
  • Advertisement
Sign in to follow this  
Bobboau

getting eye orientation

This topic is 4136 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

ok, I'm able to get the camera's position by multiplying a null vector by the inverse modelview matrix, but is there a way to get the orientation? like the forward vector or the up vector, or a matrix which will transform things in camera space into model space, inverse of modelview doesn't seem to be doing it.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Bobboau
ok, I'm able to get the camera's position by multiplying a null vector by the inverse modelview matrix, but is there a way to get the orientation? like the forward vector or the up vector, or a matrix which will transform things in camera space into model space, inverse of modelview doesn't seem to be doing it.
I'm always a bit suspicious of this sort of thing - if you set up the camera in the first place, don't you already know its position and orientation?

Anyway, when extracting camera info from the modelview matrix, you have to be sure that the modelview matrix *only* contains the view transform. You can then grab the direction vectors from the upper-left 3x3 portion of the matrix (rows if it's the view matrix, columns if you've inverted it), and the position from the inverse view matrix (elements 12, 13, and 14).

As for transforming from camera space to model space, it depends on what you mean by 'model space', but generally speaking the inverse view matrix should be what you're looking for.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!