PathFindingService Giving Closest Path To Object

A wonderful feature in the old pathfinding service that, unfortunately, is missing in the new one.

Previously, if you wanted a path between START and FINISH, but no path can be established (e.g because of a wall surrounding FINISH), the status of the path would be ‘Enun.PathStatus.ClosestNoPath’, and would return the closest path that it can find to FINISH, which doesn’t actually reach it. This was great for AI that chases the player because if the player is hidden somewhere or is in a spot that glitches the pathfinder (e.g in furniture or a bunch of small parts), then the robot would at least have a lead to work with, the closest path to the player. From there, it can try other methods of locating the player.

However, the new PathFindingService allows only 1 status for an unsuccessful path, ‘Enum.PathStatus.NoPath’, while returning an empty path object. No closest path. This makes it unbelievably frustrating to work an AI because of constant terrain glitches that result in no path and with no lead for the AI to take.

In short, I think that the old “ClosestNoPath” status should be returned with its associating function that gives you the closest path to FINISH, even if a normal one is impossible.

15 Likes