[osg-users] Camera Eye psotion in scenes with large terrain

Suraj Paul suraj at isac.gov.in
Fri Sep 23 22:03:11 PDT 2016


Hi all,

I have a scene with large terrain where a node starts moving from a given arbitrary location on the terrain. 
As the starting location of the node is known, i set the camera's target to look as the node's starting position.

My problem is I want to set the initial camera eye to get a nice view of the node before the start of its motion. 


As it is [b]large terrain[/b] and the node is initially located a position not aligned with any axes of the world cordinate frame, i am [b]finding it difficult to 'guess' what could be the location of the eye of the camera[/b].

To find it, i used nodeTracker manipulator and using the mouse i set the view. I got the nodeTracker's view matrix using:

osg::Matrixd nodeTrackerMat = nodetracker->getMatrix() ;

Then i used this matrix to get the 'eye' of the camera as:

nodeTrackerMat.getLookAt(cam_eye, cam_center, cam_up, lookdistance=1000.);

Problem is, when i see the scene by the viewer camera with its 
'eye' =cam_eye, 
'center' = cam_center 
'up' =cam_up,

it [b]gives me a view completely different from the view i got from nodeTracker. [/b] . Even with the lookdistance adjustment.

Why is this behavior?

I cannot use the nodeTracker in scene but need to set the viewer camera's eye position. 

[b]Any convenient way i can adjust the camera eye position?[/b] This issue is the scene is large one i am not able to think of ny other way i can manually set the camera eye. Can someone give a hint on how to do this?

... 

Thank you!

Cheers,
Suraj

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








More information about the osg-users mailing list