A* Pathfinding Project

Possible bug with AILerp and reachedDestination


#1

Hey, while working on a custom AI that implements AILerp, I realized that it was throwing a bug due to not calculating reachedDestination correctly sometimes (especially when passing the Seeker a custom path)

It would reach the end of the path but the destination property wasn’t set correctly to the end of that path, meaning that reachedDestination was returning false incorrectly so my code to call a new path if the unit reached its destination never ran

The fix was to add this line of code to ConfigureNewPath:

destination = interpolator.endPoint;

This fixes my issue but wanted to bring it up and also check this wouldn’t cause other issues


#2

Hi

It is not really possible to get the destination data from the path. The SetPath method documentation suggests that you set the destination property as well if you want accurate information from reachedDestination. So while this fix works in your case, it is not a general solution.