Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

getting eye orientation

Started by Bobboau Jun 23, 2007 at 7:48 PM 0 replies 500+ views
Original Post
Bobboau
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.
Bobboau, bringing you products that work... in theory
Zakwayda
Zakwayda
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.