1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-16 22:06:45 +00:00
This commit is contained in:
Mads Buvik Sandvei 2023-11-04 14:41:08 +01:00
parent 475bb1af65
commit c7c3a52e6a

View file

@ -2386,7 +2386,8 @@ namespace MWMechanics
} }
} }
osg::Vec3f movementFromAnimation = mAnimation->runAnimation(mSkipAnim && !isScriptedAnimPlaying() ? 0.f : duration); osg::Vec3f movementFromAnimation
= mAnimation->runAnimation(mSkipAnim && !isScriptedAnimPlaying() ? 0.f : duration);
if (mPtr.getClass().isActor() && isMovementAnimationControlled() && !isScriptedAnimPlaying()) if (mPtr.getClass().isActor() && isMovementAnimationControlled() && !isScriptedAnimPlaying())
{ {
@ -2401,12 +2402,14 @@ namespace MWMechanics
if (speed > 0.f && movementFromAnimation != osg::Vec3f() if (speed > 0.f && movementFromAnimation != osg::Vec3f()
&& !(isPlayer && Settings::game().mPlayerMovementIgnoresAnimation)) && !(isPlayer && Settings::game().mPlayerMovementIgnoresAnimation))
{ {
// Ensure we're moving in the right general direction. In vanilla, all horizontal movement is taken from animations, // Ensure we're moving in the right general direction. In vanilla, all horizontal movement is taken from
// even when moving diagonally (which doesn't have a corresponding animation). So to acheive diagonal movement, // animations, even when moving diagonally (which doesn't have a corresponding animation). So to acheive
// we have to rotate the movement taken from the animation to the intended direction. // diagonal movement, we have to rotate the movement taken from the animation to the intended
// // direction.
// Note that while a complete movement animation cycle will have a well defined direction, no individual frame will, and //
// therefore we have to determine the direction based on the currently playing cycle instead. // Note that while a complete movement animation cycle will have a well defined direction, no individual
// frame will, and therefore we have to determine the direction based on the currently playing cycle
// instead.
float animMovementAngle = getAnimationMovementDirection(); float animMovementAngle = getAnimationMovementDirection();
float targetMovementAngle = std::atan2(-movement.x(), movement.y()); float targetMovementAngle = std::atan2(-movement.x(), movement.y());
float diff = targetMovementAngle - animMovementAngle; float diff = targetMovementAngle - animMovementAngle;
@ -2938,7 +2941,6 @@ namespace MWMechanics
case CharState_SwimRunBack: case CharState_SwimRunBack:
case CharState_WalkBack: case CharState_WalkBack:
return mAnimation->getLegsYawRadians() - osg::PIf; return mAnimation->getLegsYawRadians() - osg::PIf;
} }
return 0.0f; return 0.0f;
} }