Hi,

thought I'd share this snippet (derived TrackballManipulator) with you.
I tried and it seems to help, though I thought I should rather move the eye 
than the center?
I am using this method to "zoom in" on a selected node.


Code:
void TrackballManipulator::computePosition(const osg::Vec3& eye,const 
osg::Vec3& center,const osg::Vec3& up)
{
  osg::Vec3 lv(center-eye);
  double newDistance = lv.length();
  // default behaviour is not to move center
  osg::Vec3 newCenter = center;

  // this limit is analogous to TrackballManipulator::calcMovement
  if (newDistance<_modelScale*_minimumZoomScale) {
    newDistance = _modelScale*_minimumZoomScale;
    lv.normalize();
    newCenter = eye + lv*newDistance;
  }

  // call base method with newCenter
  osgGA::TrackballManipulator::computePosition(eye, newCenter, up);

}



Cheers,
   Florian[/code]

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to