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

Add a threshold for changing aicombat targets (Fixes #2755)

This commit is contained in:
scrawl 2015-07-05 18:09:13 +02:00
parent 432384d280
commit 531bca1273

View file

@ -184,6 +184,11 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
const ESM::Position &targetPos = target.getRefData().getPosition(); const ESM::Position &targetPos = target.getRefData().getPosition();
float distTo = (targetPos.asVec3() - vActorPos).length(); float distTo = (targetPos.asVec3() - vActorPos).length();
// Small threshold for changing target
if (it == mPackages.begin())
distTo = std::max(0.f, distTo - 50.f);
if (distTo < nearestDist) if (distTo < nearestDist)
{ {
nearestDist = distTo; nearestDist = distTo;