Beta - richAI endReachedDistance not working all the time

endReachedDistance not working all the time. Sometimes the agents report end of path, sometimes they don’t.

This is tested with all agents moving to the same location with the same endReachedDistance.

The richAI component shows the endReachedDistance is set, but end of path sometimes never happens until the agent reaches the actual destination.

This image shows the endReachedDistance set to 3, the agent is closer than that but end of path is NOT checked.


I believe the agent also requires the end of the path to be visible from its current position. The reason is that the remaining distance might otherwise be an approximation, and it can’t be quite sure that it actually is within the required distance. I’m trying to improve this behavior in a new movement script that I’m writing.
In an open area, it should behave as expected, though.

Unity v2022.3.5f1/astar beta 4.3.79

What I was seeing was happening in wide open/unobstructed areas.

There was a single target destination in open level ground with no obstacles or other mesh cuts in between and agents were moving towards the target from different directions.

It made me add my own code to check if remainingDistance < EndReachedDistance, which then worked reliably.

From what I can see. I’m pretty sure the RichAI thinks that it has at least one more corner remaining in the path, so it will not stop.

If you have a screenshot of the situation, I may be able to help you debug it further.

Hi! I’m bumping in here because it seem I have the exact same problem.
Through some quick debugging i’ve found that “lastCorner” is setting itself to false, causing the chain:

lastCorner → approachingPartEndpoint → approachingPathEndpoint → reachedEndOfPath = false

As you wrote above it seems that it thinks there’s a corner there, though I’ve got no clue on where and how it sets it’s value. I’ve also found that enabling Funnel Simplification or not using tiles for A* seems to avoid the problem but I’d rather not rely on it if it causes performance issues down the road

Example Gif

(Enemy follower, used large endReachDistance as example)

A* component