Behavior Tree logic
Note:
1. bool value StopOnTaskEnd has been checked in both seek task.
2. Two seek task has assigned two different gameobject as destination.
Describe:
First seek task works fine. After wait for 5s, the second seek will start. But the task will immediately return success and never move.
I think is because IAstarAI is updating remainingDistance very slow after new destination has been assigned.
My temporary solution:
Change code in IAstarAIMovement.cs
Code:
protected override void Stop()
{
agent.isStopped = true;
agent.destination = Vector3.positiveInfinity;
//agent.canMove = false;
}
protected override bool HasArrived()
{
return agent.reachedDestination || (agent.remainingDistance < arriveDistance.Value && !agent.isStopped);
}