View Full Version : transfer camera view to model

04-01-2012, 09:42 AM
I try to set the camera orientation to an model...
With the camera position and the view direction I can calculate
the "look at"- direction. But how do I get the rotation of the "lool at" vector?

For those who are familiar with QT:
I try to convert QGLViewer::Camera to an glRotationf/glTranslatef on a object.


Rosario Leonardi
04-01-2012, 09:54 AM
The matrix transformation is a Rotation matrix with a translation colum (and a row of zero at the bottom and a one in the last position).

If the rotation matrices are the same the object have the same orientation, even cameras. So just copy the final rotation matrix of your object into the camera one.
The translation of the camera will be projection of the distance along the -ZAxis plus the object translation.