mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 01:19:59 +00:00
Add a threshold for changing aicombat targets (Fixes #2755)
This commit is contained in:
parent
432384d280
commit
531bca1273
@ -184,6 +184,11 @@ void AiSequence::execute (const MWWorld::Ptr& actor, CharacterController& charac
|
||||
const ESM::Position &targetPos = target.getRefData().getPosition();
|
||||
|
||||
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)
|
||||
{
|
||||
nearestDist = distTo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user