[osg-users] Get Animation current time

Robert Osfield robert.osfield at gmail.com
Sun Dec 30 00:48:32 PST 2018


Hi Diego,

On Fri, 28 Dec 2018 at 14:31, Diego Mancilla <dmancillac at gmail.com> wrote:
> So:
> 1 - Can I, from the osg::FrameStamp instance "reconstruct" the current animation time from the AnimationPath instances or from anywhere else?

The FrameStamp is set up in the Viewer::advance(..) method, you can
pass a simulation time as a double into this method() or the slightly
higher level Viewer::frame(..) method that will call advance() and the
frame traversals for you.

You can subclass from Viewer and override advance() is you so wished.

> 2- Besides the "while (!viewer.done())..." loop, is there a way to control the time sampling of the animation? i.e. the times at which the AnimationPath::getInterpolatedControlPoint method is called (from
the AnimationPathCallback::update method)?

The above suggestions is the standard way of doing it.  If this
doesn't suit then writing your own AnimationPathCallback might the
thing you want.

Robert.


More information about the osg-users mailing list