Dear OSG user

I would like that my camera will fly to the Object picked by mouse.

In order what I do is this:
1)Get the bound of the picked node
2)Compute a Matrix that represent the final camera position
3)Animate the camera

If I set the view with the computed matrix it show exactly the final position I 
want to reach by the animation….so…the first and second points are ok.
The problem occur when I set the position and rotation of the control points.

Maybe the methods getTrans and getRotate don’t return the values required by 
the “ControlPoint” class ????

Any Idea?

Here is the code:


//Get the bound
const osg::BoundingSphere& boundingSphere= subLevelNode->getBound();

//Compute new camera position
osg::Matrix myMat;
osg::Vec3 eye = boundingSphere._center+osg::Vec3( 0.0f,-3.5f * 
boundingSphere._radius, 0.0f);
osg::Vec3 center = boundingSphere._center;
osg::Vec3 up =  osg::Vec3(0.0f,0.0f,1.0f);
myMat.makeLookAt(eye,center,up);

//fly to
osg::AnimationPath* animationPath = new osg::AnimationPath;
animationPath->insert(0,osg::AnimationPath::ControlPoint(viewer.getViewMatrix().getTrans,
 viewer.getViewMatrix().getRotate));
animationPath->insert(5,osg::AnimationPath::ControlPoint(myMat.getTrans(),myMat.
 .getRotate()));
osg::ref_ptr<osgGA::AnimationPathManipulator> apm = new 
osgGA::AnimationPathManipulator(animationPath);

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to