how set Viewpoint tracking in osgearth

classic Classic list List threaded Threaded
3 messages Options
wu wu
Reply | Threaded
Open this post in threaded view
|

how set Viewpoint tracking in osgearth

with a Series of points.   I want tracking the point with Viewpoint .for example osg::AnimationPath. anyone can show how to do it in osgearth. thanks!
Tension Tension
Reply | Threaded
Open this post in threaded view
|

Re: how set Viewpoint tracking in osgearth

Try osgGA::AnimationPathManipulator. Construct it with your AnimationPath (or file) and use it as your camera manipulator (for example: view->setCameraManipulator(_animationPathManipulator)).

You can save your previous camera manipulator somewhere, so you can bring it back when you done with your tracking.

Check osgViewer::RecordCameraPathHandler for reference.
wu wu
Reply | Threaded
Open this post in threaded view
|

Re: how set Viewpoint tracking in osgearth

hi,I try use osgGA::AnimationPathManipulator for example:
     osg::ref_ptr<osgGA::AnimationPathManipulator> _apm;
     _apm->setAnimationPath(createAnimationByTwoPoints(eye, viewMatrix.getRotate(), hitPoint));                
     _apm->setTimeOffset(-ea.getTime());
     _mViewer->setCameraManipulator(_apm);

osg::MatrixTransform* mtAp = new osg::MatrixTransform;
mtAp->addUpdateCallback(new osg::AnimationPathCallback(createAnimationByTwoPoints(eye, viewMatrix.getRotate(), hitPoint)));
mtAp->addUpdateCallback(new apCtrl());
root->addChild(mtAp);

then I reset Manipulator in addUpdateCallback of apCtrl()
_mViewer->setCameraManipulator(manipulator);
 

but I cant operate the  osgearth use mouse;
is there error in my code?
thanks´╝ü