Archived

This topic is now archived and is closed to further replies.

GL_MODELVIEW_MATRIX

This topic is 5008 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! I''m completly controling a camera with a matrix. Well - Now I have an array with 16 entries and I don''t know how I can get the position of the camera and the current rotation. Could someone help me? thanks :D glLoadIdentity(); glMultMatrixf(cam->Matrix); cam->Position.x = ? cam->Position.y = ? cam->Position.z = ? cam->Rotation.x = ? cam->Rotation.y = ? cam->Rotation.z = ?

Share this post


Link to post
Share on other sites
well, in your example you just use this for getting the position:

Vector3 getPosition()
{
return Vector3(m[12],m[13],m[14]);
}

I tried this before, too, in my camera.cpp. But if I rotate the camera the position get wired.

Share this post


Link to post
Share on other sites
no. not quite. I said for a matrix''s position you get element 12,13 and 14. But the modelview is the inverse of the matrix represnting the position of the camera... so these values will not be the position of the camera at all. You will need to invert the matrix to get the position.

Share this post


Link to post
Share on other sites