<div dir="ltr"><div>Hey Rodrigo,</div><div><br></div><div>You have to set the home position of your camera manipulator and make a call to home(1). You can force the delta time with a 1.</div><div><br></div><div>Sam<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 7, 2019 at 6:48 PM Rodrigo Dias <<a href="mailto:rodrigo1406@gmail.com">rodrigo1406@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm able to change the camera's position with TrackballManipulator. However, I'd like to change the camera's initial position, but all the examples I've found just won't work. My source code is:<br>
<br>
<br>
Code:<br>
#include <iostream><br>
#include <osg/Camera><br>
#include <osgDB/ReadFile><br>
#include <osgGA/TrackballManipulator><br>
#include <osgViewer/Viewer><br>
#include <osgEarth/ImageLayer><br>
#include <osgEarth/Map><br>
#include <osgEarth/MapNode><br>
#include <osgEarthDrivers/tms/TMSOptions><br>
#include <osgEarthDrivers/gdal/GDALOptions><br>
<br>
using namespace std;<br>
using namespace osg;<br>
using namespace osgEarth;<br>
using namespace osgEarth::Drivers;<br>
<br>
int main (int argc, char** argv) {<br>
        MapOptions mapOpt;<br>
        mapOpt.coordSysType() = MapOptions::CSTYPE_PROJECTED;<br>
        mapOpt.profile() = ProfileOptions("plate-carre");<br>
        osg::ref_ptr<Map> map = new Map(mapOpt);<br>
        {<br>
                GDALOptions gdal;<br>
                gdal.url() = "br_modified.tif";<br>
                osg::ref_ptr<ImageLayer> layer = new ImageLayer( "BR", gdal );<br>
                map->addLayer( layer );<br>
        }<br>
        {<br>
                GDALOptions gdal;<br>
                gdal.url() = "BRalt.tif";<br>
                osg::ref_ptr<ElevationLayer> layer = new ElevationLayer( "SRTM", gdal );<br>
                map->addLayer( layer );<br>
        }<br>
        osg::ref_ptr<MapNode> mapNode = new MapNode( map );<br>
        osgViewer::Viewer viewer;<br>
        viewer.setSceneData( mapNode.get() );<br>
        viewer.setCameraManipulator( new osgGA::TrackballManipulator );<br>
<br>
        Vec3 eye( 10000.0, 50000.0, 100000.0 ); // The position of your camera<br>
        Vec3 center( 0.0, 0.0, 0.0 ); // The point your camera is looking at<br>
        Vec3 up( 0.0, 1.0, 0.0 ); // The up-vector of your camera - this controls how your viewport will be rotated about its center and should be equal to [0, 1, 0] in a conventional graphics coordinate system<br>
        viewer.getCamera()->setViewMatrixAsLookAt( eye, center, up );<br>
        while ( !viewer.done() ) {<br>
                viewer.frame();<br>
        }<br>
        return 0;<br>
}<br>
<br>
<br>
<br>
<br>
No matter which values I use for "eye", the camera always begins in the same position. Why is that?<br>
<br>
Thank you!<br>
<br>
Cheers,<br>
Rodrigo<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=75411#75411" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=75411#75411</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>