|
|
|
@ -463,7 +463,7 @@ namespace MWMechanics
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// have not yet reached the destination
|
|
|
|
|
evadeObstacles(actor, duration, storage);
|
|
|
|
|
evadeObstacles(actor, storage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -494,15 +494,12 @@ namespace MWMechanics
|
|
|
|
|
storage.setState(AiWanderStorage::Wander_IdleNow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AiWander::evadeObstacles(const MWWorld::Ptr& actor, float duration, AiWanderStorage& storage)
|
|
|
|
|
void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage)
|
|
|
|
|
{
|
|
|
|
|
if (mUsePathgrid)
|
|
|
|
|
{
|
|
|
|
|
const auto halfExtents = MWBase::Environment::get().getWorld()->getHalfExtents(actor);
|
|
|
|
|
const float actorTolerance = 2 * actor.getClass().getSpeed(actor) * duration
|
|
|
|
|
+ 1.2 * std::max(halfExtents.x(), halfExtents.y());
|
|
|
|
|
const float pointTolerance = std::max(MIN_TOLERANCE, actorTolerance);
|
|
|
|
|
mPathFinder.buildPathByNavMeshToNextPoint(actor, halfExtents, getNavigatorFlags(actor), pointTolerance);
|
|
|
|
|
mPathFinder.buildPathByNavMeshToNextPoint(actor, halfExtents, getNavigatorFlags(actor));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mObstacleCheck.isEvading())
|
|
|
|
|