Support Forum

reachedDestination vs reachedEndOfPath

I was looking to know when an entity reached the end of that current path and I was using reachDestination but then notice that AIPath would stop (has a much higher End Reached Distance) but reachDestination would be false and then looking at the documentation I found reachedEndOfPath which seems to work.

I don’t see reachDestination in the documentation so was wondering what is the different between the 2 and which to use when?

Hi

The property is called reachedDestination, that’s probably why you didn’t find it.

Here’s the documentation for it: https://arongranberg.com/astar/docs/iastarai.html#reachedDestination

Well it is weird that it recommends to use reachedDestination which for me does not seems to be really working (unless I am missing what that means).

Why would the AIPath stop moving the entity even though reachDestination is still false?

It might have stopped moving because it cannot get closer. However, just because it cannot get closer doesn’t mean it has actually reached the specified destination.

I guess I am still unsure why reachedDestination is false when the AIPath stops, reachedEndOfPath is true, and the remainingDistance (which is 2.95) is less than the End Reach Distance (3). This is a 2D game, maybe I have something wrong with my settings?

That’s odd. Unless you have recently changed the destination, then it should work.

This is the code for it