Dear all...
Im a new osg user and probably this is a topic yet discussed in the
newsletter
I took a look in the archive but I did not solved my problem.
I have a scene with lots of drawable
I need to set the position of the camera in order to look at one single
drawable
.
as example
by a GUI I select the name of the drawable and it automatically
should move to that object.
Is there a camera function that automatically set the camera position simply
passing the node of the object to be visualized?...or a sort of fly to function?
My idea is to first get the bound of the node
const osg::BoundingSphere& boundingSphere=animationNode->getBound();
and then set the camera position using this bound
.but
I exactly dont know how
to do that
This topic was discussed in the mail with title Set camera position
programatically.
In that mail the solution is to use this function
osg::Camera* camera = SceneView()->getCamera();
camera->setLookAt( eye, center, up );
and then Go through all manipulators and update the camera position:
CameraManipList::iterator it;
osgGLUT::GLUTEventAdapter ea;
ViewportList::iterator viewport = _viewportList.begin();
for(;viewport != _viewportList.end(); viewport++) {
for(it = (*viewport)._cameraManipList.begin(); it !=
(*viewport)._cameraManipList.end();it++) {
osgGA::TrackballManipulator *tm =
dynamic_cast<osgGA::TrackballManipulator *>(it->get());
if (tm)
tm->init(ea, *this);
}
}
This is exactly what I need
but the setLookAt method it doesnt exist anymore
in my osg version.
How can I do that?..is this the only way?
Thank you!!!!
Matteo
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/