Merge pull request #2833 from Capostrophic/animscale

Cap movement animation playback speed
pull/578/head
Andrei Kortunov 5 years ago committed by GitHub
commit c0dc5eb4df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

Loading…
Cancel
Save