Hi Jay, There isn't an osgGA::CameraManipulator for doing specifically what you want so you'll need to write your own CameraManipulator to do this or simply set the viewer's Camera's view matrix each frame within the frame loop. This shouldn't be difficult, the OSG has Matrix/Vec3 classes to help with maths. All you need to do is find the position of the two nodes you want to track, computer their position in world coordinates using the osg::computeLocalToWorldMatrix(nodePath) and their local center of interest that you want to use, then do the maths you want to derive the view matrix and apply this per frame.
Robert. On 19 February 2015 at 00:01, Jay Loid <foboi1...@hotmail.com> wrote: > I'm just starting to play around with openscenegraph and I'd like to know > if what I'm describing is possible. I have two nodes, which may both have > paths. I'd like to attach a line of sight camera between the two nodes in > such a way that the camera is aiming at node 1 from node 2 at all times. > I'd then also like to be able to zoom in and out relative to this line of > sight. > > I tried setting up a NodeTrackerManiulator, but that class seems to be > able to freely track just one node. However, I need something that can > track a node with camera movement constrained by another node. I tried > something like the following: > > > Code: > > osg::ref_ptr<osgGA::NodeTrackerManipulator> manip2 = new > osgGA::NodeTrackerManipulator; > manip2->setTrackNode(plane); > manip2->setNode(sensor); > manip2->setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER); > addView(manip2.get()); > > > > > but it seems to still freely track just the plane node. > > Thanks in advance, > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=62724#62724 > > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org