1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Cap movement animation playback speed

This commit is contained in:
Capostrophic 2020-05-11 15:11:32 +03:00
parent 7a6ba8bf7a
commit ece0db4f82

View File

@ -2289,8 +2289,12 @@ void CharacterController::update(float duration, bool animationOnly)
}
else if (mMovementState != CharState_None && mAdjustMovementAnimSpeed)
{
float speedmult = speed / mMovementAnimSpeed;
mAnimation->adjustSpeedMult(mCurrentMovement, speedmult);
// Vanilla caps the played animation speed.
const float maxSpeedMult = 10.f;
const float speedMult = speed / mMovementAnimSpeed;
mAnimation->adjustSpeedMult(mCurrentMovement, std::min(maxSpeedMult, speedMult));
// Make sure the actual speed is the "expected" speed even though the animation is slower
scale *= std::max(1.f, speedMult / maxSpeedMult);
}
if (!mSkipAnim)