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

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Tue May 12 01:52:49 PDT 2020


I managed to do that inside the `handle` method:

    osg::Vec3d eyePos;
    osg::Matrix matrix = _viewer->getCameraManipulator()->getMatrix();
    eyePos = matrix.getTrans();
    lat = eyePos.y();
    lon = eyePos.x();
    alt = eyePos.z();


On Wednesday, August 22, 2012 at 3:21:20 PM UTC-3, Paul Leopard wrote:
>
> I want to query osgViewer to get the current camera position (Note: not 
> the home position). As I move around in a scene I want to know the current 
> coordinates of my eyepoint so that I can save it to a configuration file so 
> that the next time I run my app I can read that position and set it as the 
> home position. 
>
> How can I simply get the current eye position (same coordinate frame as 
> the home position is specified in). 
>
> Thanks in advance, 
> Paul 
>
> ------------------ 
> Read this topic online here: 
> http://forum.openscenegraph.org/viewtopic.php?p=49410#49410 
>
>
>
>
>
> _______________________________________________ 
> osg-users mailing list 
> osg-... at lists.openscenegraph.org <javascript:> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
>

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/d8156700-7b09-467c-8e69-ed9379b533ea%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200512/5d7202d4/attachment.html>


More information about the osg-users mailing list