From eb45f9988058a33f02315cf574da7f980b81ae9b Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 5 Mar 2019 23:18:13 +0300 Subject: [PATCH 1/2] Remove unused code --- apps/openmw/mwmechanics/pathfinding.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/openmw/mwmechanics/pathfinding.hpp b/apps/openmw/mwmechanics/pathfinding.hpp index 567056fa5..56c7567c2 100644 --- a/apps/openmw/mwmechanics/pathfinding.hpp +++ b/apps/openmw/mwmechanics/pathfinding.hpp @@ -46,7 +46,6 @@ namespace MWMechanics } const float PATHFIND_Z_REACH = 50.0f; - //static const float sMaxSlope = 49.0f; // duplicate as in physicssystem // distance after which actor (failed previously to shortcut) will try again const float PATHFIND_SHORTCUT_RETRY_DIST = 300.0f; From cf1e1d9f4bcc6fc1dc79c132534b83d7256ed4ba Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 5 Mar 2019 23:15:15 +0300 Subject: [PATCH 2/2] Use min point tolerance to prevent face wrong direction (bug #4814) When next path point is too close to actor and it has speed 0, it can face direction not pointing to path target. --- apps/openmw/mwmechanics/aipackage.cpp | 2 +- apps/openmw/mwmechanics/pathfinding.hpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index 0fa92c301..698b2efce 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -167,7 +167,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f& mTimer = 0; } - const float pointTolerance = std::min(actor.getClass().getSpeed(actor), DEFAULT_TOLERANCE); + const float pointTolerance = std::max(MIN_TOLERANCE, std::min(actor.getClass().getSpeed(actor), DEFAULT_TOLERANCE)); mPathFinder.update(position, pointTolerance, DEFAULT_TOLERANCE); diff --git a/apps/openmw/mwmechanics/pathfinding.hpp b/apps/openmw/mwmechanics/pathfinding.hpp index 56c7567c2..8a5b8338a 100644 --- a/apps/openmw/mwmechanics/pathfinding.hpp +++ b/apps/openmw/mwmechanics/pathfinding.hpp @@ -49,6 +49,7 @@ namespace MWMechanics // distance after which actor (failed previously to shortcut) will try again const float PATHFIND_SHORTCUT_RETRY_DIST = 300.0f; + const float MIN_TOLERANCE = 1.0f; const float DEFAULT_TOLERANCE = 32.0f; // cast up-down ray with some offset from actor position to check for pits/obstacles on the way to target;