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

Object Space

Started by Johnny123 Jan 4, 2007 at 8:01 AM 0 replies 900+ views
Original Post
Johnny123
Johnny123
I'm sure how exactly to word this question, as days of searching have failed to reveal a clear solution. From any current model_view matrix, how would you calculate the position of the camera? That is in object space, since the camera is alway at 0,0,0 in world space. (I don't know if that makes sense, but I explain to myself what I want is, after a bunch of Translations, and Rotations, how do I get the position of the camera assuming the current space (Matrix) is at 0,0,0?) I'm not completely new to OpenGL and Matrix Math, but I don't know how to word this question without sounding like a beginner. I understand the kind of math involved, I just need help with getting the code started.
Eitsch
Eitsch
translation of camera is the last column (modelveiw[12],modelview[13],modelview[14]) of inverted modelview matrix.


in some cases inverse is sufficient. klick
for me it works somehow like this:
glGetFloatfv(GL_MODELVIEW_MATRIX,mv):matrix modelviewMatrix = mv;matrix modelviewMatrixTranspose = modelviewMatrix.transpose();cameraPosition = modelviewMatrixTranspose * vector(mv[12],mv[13],mv[14]);

Topic Locked

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

Sign in to reply to this topic.