diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index bd248438bd..1cb67d78be 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -546,8 +546,9 @@ bool Animation::resetActiveGroups() bool ismoving = false; - const NifOgre::TextKeyMap &keys = state->second.mSource->mTextKeys; - std::vector >&ctrls = state->second.mSource->mControllers[0]; + const AnimSource *animsrc = state->second.mSource; + const NifOgre::TextKeyMap &keys = animsrc->mTextKeys; + const std::vector >&ctrls = animsrc->mControllers[0]; for(size_t i = 0;i < ctrls.size();i++) { NifOgre::NodeTargetValue *dstval; @@ -562,6 +563,23 @@ bool Animation::resetActiveGroups() } } + // If there's no velocity, keep looking + while(!(mAnimVelocity > 1.0f) && animsrc-- != &mAnimSources[0]) + { + const NifOgre::TextKeyMap &keys = animsrc->mTextKeys; + const std::vector >&ctrls = animsrc->mControllers[0]; + for(size_t i = 0;i < ctrls.size();i++) + { + NifOgre::NodeTargetValue *dstval; + dstval = static_cast*>(ctrls[i].getDestination().getPointer()); + if(dstval->getNode() == mNonAccumRoot) + { + mAnimVelocity = calcAnimVelocity(keys, dstval, mAccumulate, state->first); + break; + } + } + } + return ismoving; }