Fix BehaviorTreeMoveToNode when goal location changes every frame by less than tolerance

This commit is contained in:
Wojtek Figat
2024-09-30 23:15:16 +02:00
parent c063afc5bc
commit bfa09e165a

View File

@@ -444,7 +444,6 @@ BehaviorUpdateResult BehaviorTreeMoveToNode::Update(const BehaviorUpdateContext&
else
goalLocation = TargetLocation.Get(context.Knowledge);
repath |= Vector3::Distance(goalLocation, state->GoalLocation) > TargetGoalUpdateTolerance;
state->GoalLocation = goalLocation;
}
if (repath)
@@ -490,6 +489,7 @@ BehaviorUpdateResult BehaviorTreeMoveToNode::Update(const BehaviorUpdateContext&
state->HasPath = true;
state->TargetPathIndex = 1;
state->Result = BehaviorUpdateResult::Running;
state->GoalLocation = goalLocation;
// TODO: add path debugging in Editor (eg. via BT window)