diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cb088e801..43ffadd808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -143,6 +143,7 @@ Bug #6794: Light sources are attached to mesh bounds centers instead of mesh origins when AttachLight NiNode is missing Bug #6799: Game crashes if an NPC has no Class attached Bug #6849: ImageButton texture is not scaled properly + Bug #6860: Sinnammu randomly strafes while running on water Bug #6869: Hits queue stagger during swing animation Bug #6890: SDL_PeepEvents errors are not handled Bug #6895: Removing a negative number of items from a script, makes the script terminate with an error diff --git a/apps/openmw/mwmechanics/obstacle.cpp b/apps/openmw/mwmechanics/obstacle.cpp index 0f73890eb7..3221513f48 100644 --- a/apps/openmw/mwmechanics/obstacle.cpp +++ b/apps/openmw/mwmechanics/obstacle.cpp @@ -137,11 +137,18 @@ namespace MWMechanics mStateDuration = 0; mPrev = position; mInitialDistance = (destination - position).length(); + mDestination = destination; return; } if (mWalkState != WalkState::Evade) { + if (mDestination != destination) + { + mInitialDistance = (destination - mPrev).length(); + mDestination = destination; + } + const float distSameSpot = DIST_SAME_SPOT * actor.getClass().getCurrentSpeed(actor) * duration; const float prevDistance = (destination - mPrev).length(); const float currentDistance = (destination - position).length(); diff --git a/apps/openmw/mwmechanics/obstacle.hpp b/apps/openmw/mwmechanics/obstacle.hpp index 2026f22129..db17d0a8b8 100644 --- a/apps/openmw/mwmechanics/obstacle.hpp +++ b/apps/openmw/mwmechanics/obstacle.hpp @@ -45,6 +45,7 @@ namespace MWMechanics private: osg::Vec3f mPrev; + osg::Vec3f mDestination; // directions to try moving in when get stuck static const float evadeDirections[NUM_EVADE_DIRECTIONS][2];