1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 23:39:43 +00:00

movement = movementFromAnimation; also when speed is 0.

This commit is contained in:
Mads Buvik Sandvei 2023-11-05 16:46:11 +01:00
parent e86a4ebafe
commit acf6178ea5

View file

@ -2399,8 +2399,7 @@ namespace MWMechanics
movementFromAnimation.x() *= scale; movementFromAnimation.x() *= scale;
movementFromAnimation.y() *= scale; movementFromAnimation.y() *= scale;
if (speed > 0.f && movementFromAnimation != osg::Vec3f() if (speed > 0.f && movementFromAnimation != osg::Vec3f())
&& !(isPlayer && Settings::game().mPlayerMovementIgnoresAnimation))
{ {
// Ensure we're moving in the right general direction. In vanilla, all horizontal movement is taken from // Ensure we're moving in the right general direction. In vanilla, all horizontal movement is taken from
// animations, even when moving diagonally (which doesn't have a corresponding animation). So to acheive // animations, even when moving diagonally (which doesn't have a corresponding animation). So to acheive
@ -2413,9 +2412,12 @@ namespace MWMechanics
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;
movement = osg::Quat(diff, osg::Vec3f(0, 0, 1)) * movementFromAnimation; movementFromAnimation = osg::Quat(diff, osg::Vec3f(0, 0, 1)) * movementFromAnimation;
} }
if (!(isPlayer && Settings::game().mPlayerMovementIgnoresAnimation))
movement = movementFromAnimation;
if (mFloatToSurface) if (mFloatToSurface)
{ {
if (cls.getCreatureStats(mPtr).isDead() if (cls.getCreatureStats(mPtr).isDead()