zen

04-30-2001, 01:04 PM

I'm trying to implement a camera model. It shouldn't be first or thrid-person perspective specific because I'm planning on using both so I'm trying to keep it as generic as possible.

So this is what I'm thinking:

The camera is essentially a coordiante system described by a matrix,the camera matrix. By multiplying this matrix to the modelview matrix you should be able to map the world coord. sytem to the camera coord. system. My goal is to create my camera model in such a way that I can make arbitary rotations and translations in the **camera's** coordinate system,just like you do with glRotate and glTranslate in the world's coordinate system.

So I was thinking of using a 3x3 matrix to represent camera rotation/orientation and a 3-vector to implement translation/position.When I want to create a 4x4 homogenous matrix for use mith glMultMatrixf I just create 4x4 rotation matrix out of the camera's matrix and a 4x4 matrix for translation out of the 3-vector. I then multiply the rotation matrix by the translation matrix and I'm done. Yet if I mutiply a rotation matrix by the camera's 3x3 matrix I get a rotation around the world coordinate system translated to the camera position. I want to be able to rotate around the camera's coord. system so I'm doing something wrong. The translation also takes place around the worlds coord. system but that's ok since the camera position specified by the 3-vector is supposed to be in world coordinates.

a)Does any of the above make sense?

b)Does anyone know of a way of implementing a camera model to achieve what I want?

Thanx in advance.

So this is what I'm thinking:

The camera is essentially a coordiante system described by a matrix,the camera matrix. By multiplying this matrix to the modelview matrix you should be able to map the world coord. sytem to the camera coord. system. My goal is to create my camera model in such a way that I can make arbitary rotations and translations in the **camera's** coordinate system,just like you do with glRotate and glTranslate in the world's coordinate system.

So I was thinking of using a 3x3 matrix to represent camera rotation/orientation and a 3-vector to implement translation/position.When I want to create a 4x4 homogenous matrix for use mith glMultMatrixf I just create 4x4 rotation matrix out of the camera's matrix and a 4x4 matrix for translation out of the 3-vector. I then multiply the rotation matrix by the translation matrix and I'm done. Yet if I mutiply a rotation matrix by the camera's 3x3 matrix I get a rotation around the world coordinate system translated to the camera position. I want to be able to rotate around the camera's coord. system so I'm doing something wrong. The translation also takes place around the worlds coord. system but that's ok since the camera position specified by the 3-vector is supposed to be in world coordinates.

a)Does any of the above make sense?

b)Does anyone know of a way of implementing a camera model to achieve what I want?

Thanx in advance.