Hi Sanat,
For the bottom left view, I wanted a view of the 3D model (backhoe) and the
terrain with the camera either inside the cab of the backhoe or hovering just
above it. So I did the following:
Code:
view->setSceneData(backhoe1PAT);
//where backhoe1PAT is the positionAtttransform of the 1st backhoe.
view->setCameraManipulator(new osgGA::TrackballManipulator);
view->getCamera()->setUpdateCallback(new
CameraFollowMyNodeCallback(backhoe1PAT));
//follows backhoe1 in the overall scene view as in the topmost scene
However on running this code, as you can see the bottom-left view shows only
the backhoe and not resting on the underlying terrain. So I wanted to know what
I am doing wrong
Well, it seems to me you're getting the results your code asks for.
view->setSceneData(backhoe1PAT);
means that the view1 will only see the backhoe, because it's the only
scene graph it knows about. You need to do
view->setSceneData(root);
Additionally, as Robert said, your camera manipulator and your camera
update callback will fight to control the values in your camera's view
matrix (i.e. they will each try to change your camera's position). Use
one or the other. If you want to follow the backhoe in a fixed way you
can use a camera update callback, but if you want to follow it but be
able to change the angle with the mouse use a camera manipulator, in
particular osgGA::NodeTrackerManipulator can do this. Search the OSG
examples in the source code to see how to use it.
Hope this helps,
J-S
--
______________________________________________________
Jean-Sebastien Guay [email protected]
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org