[osg-users] How to get current position of osgViewer camera

lawrence wong osgforum at tevs.eu
Mon Nov 16 08:18:01 PST 2015


Hi,
I found another way to get the camera position, if it suits one's needs:)

you could use the previous solution:

osg::Vec3 eye, center, up;
viewer->getCamera()->getViewMatrixAsLookAt( eye, center, up );

then, the result you want is in the 'eye' variable, the other 2 vars are just 'fillers'.

or:

osg::Vec3 eye = viewer->getCamera()->getInverseViewMatrix().getTrans();


Thank you!

Cheers,
Drout

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65657#65657








More information about the osg-users mailing list