Animating the transformation nodes
Path animations are the most commonly-used animations in graphics applications. They can be used to describe a running car, a flight, a rotating ball, or the camera's motion. The path should always be set up first, including position, rotation, and scale values at different key time nodes. When the simulation loop is running, a transition state is calculated every frame, using the linear interpolation for position and scale vectors, and spherical linear interpolation for the rotation quaternion. The slerp()
method of osg::Quat
is used internally here.
OSG provides the osg::AnimationPath
class to encapsulate a time varying transformation path. It has an insert()
method that can be used to insert a control point at a specific time. A control point, declared by the osg::AnimationPath::ControlPoint
class, accepts a position value, and optional rotation and scale values in order to construct the animation path. For example:
osg::ref_ptr<osg::AnimationPath...