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.
pull/541/head
elsid 6 years ago
parent eb45f99880
commit cf1e1d9f4b
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

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

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

Loading…
Cancel
Save