[osg-users] setViewMatrixAsLookAt where is center?

Ariasgore ariasgore at gmx.de
Sat Jul 26 08:04:45 PDT 2008


Hello,
I was trying to use the setViewMatrixAsLookAt matrix like I would use 
gluLookAt (since they are similar), my intention is to create a rotation 
around a point. So first I selected the eye position which should be 
(0,-25,25)  and wanted to point the camera towards (0,0,0) where my object 
is placed, so basically the code looks like this:

viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3(0,-25,25), 
osg::Vec3(0,0,0), osg::Vec3(0,1,0) );

but rendering this scene creates some confusing perspective, the position of 
the camera seems right but even if I am looking at (0,0,0) the object I am 
looking at is at the top of the screen and not centered, as I supposed.
While placing the object at scene's origin, shouldn't this setup center this 
object since I am looking at (0,0,0) ?

Greetings
 




More information about the osg-users mailing list