Dear all,
I need to move an object along a line with the speed of 1m/s. The
object starts from stationary (0m/s). I use AnimationPath like this:

                osg::AnimationPath* animationPath = new osg::AnimationPath;
        animationPath->setLoopMode(osg::AnimationPath::NO_LOOPING);

                osg::Vec3 startPoint(startMat(3,0), startMat(3,1),
startMat(3,2));
        animationPath->insert(0.0,osg::AnimationPath::ControlPoint(startPoint
, rotation));

        osg::Vec3 endPoint(endMat(3,0), endMat(3,1), endMat(3,2));

                float speed = 1.0; // (m/s)
                float timeOfAnimation = distanceFromStartPointToEndPoint/speed;

        
animationPath->insert(timeOfAnimation,osg::AnimationPath::ControlPoint(endPoint
, rotation));

        matTransNode.setUpdateCallback(new 
osg::AnimationPathCallback(animationPath));

The animation works, but it seems to me that the speed instantly
becomes 1m/s and there's no acceleration. So my question is: is there
a way I can specify that, say, in the first second the acceleration is
+1 m/s^2, and the next few seconds the acceleration is 0 m/s^2 (so
that the speed is constant), and then in the last second the
acceleration is -1 m/s^2?

Thank you very much for your help.
Best,
Dat
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to