Pathfinding doesn't properly check waypoints for obstructions between each other

Expected behaviour:
Pathfinding should link waypoints that can actually be reached by each other

Actual behaviour:
Pathfinding generates an impossible path by placing a seemingly random waypoint far below the terrain region, and connecting it with a waypoint on the terrain itself.

As seen in the image above, pathfinding has linked waypoints that can’t be reached by simply walking, causing the NPC to become stuck in an endless loop of trying to reach a waypoint it can’t, moving around randomly in an attempt to get un-stuck.

Studio has the “Show Navigation Mesh” option turned on, the only other path indicator is the slightly transparent green square that indicates the waypoint the NPC is trying to get to, called “Goal” under workspace.

Place file:
npc smooth pathing.rbxl (57.5 KB)

Repro steps:
Unknown, but may be related to having a waypoint over some sort of terrain boundary? An issue with raycasting has been reported before: Raycast misses Terrain in a specific pattern - #7 by Etheroit

Even if the issue of the waypoint going through the terrain is due to raycasting, there’s still the issue of pathfinding not checking if there’s any obstruction between the two waypoints.

Impact: High
This can completely break NPCs on maps with terrain, as the waypoint becomes unreachable and the NPC gets stuck in an infinite loop.

Workaround:
Re-generate the path every once in a while, this is really only a failure state if the path is never re-calculated, but is a game-breaking issue nontheless.

First noticed: ~28th August, 2022
Last occurred: 13th September, 2022

Thanks for the report!

We’ve filed a ticket to our internal database, and we’ll follow up when we have an update for you.

2 Likes

Hi!

Thanks for referring to the Raycast issue, just gonna add here that the raycast issue should have been fixed in version 512. Haven’t confirmed that though.

https://create.roblox.com/docs/resources/release-note/Release-Note-for-512

1 Like

It always happens on the same spot, and I remember running into the raycasting issue before, so I just assumed that pathfinding was trying to use raycasts to put a waypoint on the ground, but because of this terrain issue, it misses the terrain.

But,

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

The problem no longer appears to occur on the repro file, the bug was likely fixed in some update.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.