diff --git a/include/osg/AnimationPath b/include/osg/AnimationPath index 166bd0232..ba580303d 100644 --- a/include/osg/AnimationPath +++ b/include/osg/AnimationPath @@ -20,6 +20,7 @@ #include #include +#include namespace osg { @@ -188,7 +189,7 @@ class SG_EXPORT AnimationPathCallback : public NodeCallback AnimationPathCallback(): _timeOffset(0.0), _timeMultiplier(1.0), - _firstTime(0.0), + _firstTime(DBL_MAX), _latestTime(0.0), _pause(false), _pauseTime(0.0) {} @@ -213,7 +214,7 @@ class SG_EXPORT AnimationPathCallback : public NodeCallback _useInverseMatrix(false), _timeOffset(timeOffset), _timeMultiplier(timeMultiplier), - _firstTime(0.0), + _firstTime(DBL_MAX), _latestTime(0.0), _pause(false), _pauseTime(0.0) {} diff --git a/src/osg/AnimationPath.cpp b/src/osg/AnimationPath.cpp index 6fd073bb0..0f3a8ccf2 100644 --- a/src/osg/AnimationPath.cpp +++ b/src/osg/AnimationPath.cpp @@ -147,7 +147,6 @@ class AnimationPathCallbackVisitor : public NodeVisitor bool _useInverseMatrix; }; - void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv) { if (_animationPath.valid() && @@ -159,7 +158,8 @@ void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv) if (!_pause) { - if (_firstTime==0.0) _firstTime = time; + // Only update _firstTime the first time, when its value is still DBL_MAX + if (_firstTime==DBL_MAX) _firstTime = time; update(*node); } }