[osg-users] setViewMatrixAsLookAt not working to set the initial camera position
OpenSceneGraph Users
osg-users at lists.openscenegraph.org
Tue May 12 02:04:53 PDT 2020
Back at it again...
I'm using a Brazil georeferenced map, so I know what coordinates are good
enough to be above the country, high enough to see it all, looking down:
(...)
osgViewer::Viewer viewer;
viewer.setSceneData( root.get() );
osg::ref_ptr<OVNIController> controller = new OVNIController(&viewer);
// my own WASD flying controller
viewer.setCameraManipulator(controller);
viewer.getCamera()->setViewMatrixAsLookAt(
osg::Vec3(-55.0f,-15.0f,50.0f), osg::Vec3(), osg::Y_AXIS ); // eye (lon,
lat, alt), center, up
viewer.getCameraManipulator()->home(1);
viewer.realize();
while ( !viewer.done() ) { viewer.frame(); }
return 0;
I don't know if setViewMatrixAsLookAt() and home() should go before or
after realize(). Played with the axis as 3rd parameter for
setViewMatrixAsLookAt, but the camera just won't move! Any help, please?
On Tuesday, January 8, 2019 at 1:39:53 AM UTC-2, sam wrote:
>
> After you set the home position try:
> viewer.getCameraManipulator()->home(1);
>
> Sorry I'm not right in front of my computer right now.
>
> On Mon, Jan 7, 2019 at 7:26 PM Rodrigo Dias <rodri... at gmail.com
> <javascript:>> wrote:
>
>> Hi Sam,
>>
>> By "home" I think you mean
>>
>>
>> Code:
>> viewer.getCameraManipulator()->setHomePosition( eye, center, up );
>>
>>
>>
>>
>> This really changed camera's position, though it's totally freaking out
>> now (I'm still fiddling with the values in eye, center and up).
>>
>> But I have no idea what you meant by "delta time", something to go inside
>> the loop?
>>
>> Thank you!
>>
>> Cheers,
>> Rodrigo
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=75413#75413
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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/9bf0c1bb-6a74-4050-b6a5-6e99b2eac70f%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200512/12121f17/attachment.html>
More information about the osg-users
mailing list