- A * version: [5.3.0]
- Unity version: [2022.3.44f1]
Hello,
I am trying to get Player to catch up with NPC.
Player has the FollowerEntity with Speed 5.
NPC has the FollowerEntity with Speed 3.
If NPC is running to the right and Player is following, then he catches up, but Player never reaches the stoppdingDistance. If I change the stopping distance, the player will always be like 0.44f further away than just the stoppingDistance. The Player also slows down to match the speed of the NPC.
How can I solve this?
Here is a GIF: ezgif.com video to gif converter - Gifyu
Used Code:
void Update()
{
if(isMoving)
{
Debug.Log(ai.remainingDistance + "/" + ai.stopDistance);
if(ai.reachedDestination && !ai.pathPending)
{
isMoving = false;
targetNPC = null;
foreach (Action action in onDestinationReached)
{
action?.Invoke();
}
onDestinationReached.Clear();
}
else
{
if(targetNPC != null)
{
ai.SetDestination(targetNPC.transform.position);
}
}
}
}