Why is my pathfinding doing this?

I’m using roblox pathfinding for a new project I’m working on (its one of those games), however my NPC pathfinding is doing really weird things with no logical reason as to why.

For some reason, when I compute a path, they’re deciding to walk into the wall for a second before then going to the target point, here’s a screenshot showing what I mean:


Red = enter path
Green = exit path

Every single path does the exact same thing and I have zero idea why. The navmesh is correct and so are their parameters, so I don’t see any reason for them to do this.

Is this just roblox jank or is there something I could be doing wrong?

3 Likes

It could be a couple of things causing that weird NPC movement. One possibility is that something in the environment is physically obstructing the NPC—like a collision issue with meshes or unions—that makes it “bump” into the wall before continuing.

Another possibility is that the pathfinding calculation itself isn’t producing a clean curve. Roblox’s pathfinding sometimes generates jagged routes or odd detours instead of smooth ones, and NPCs just follow that without correcting it.

It might also just be Roblox being Roblox—pathfinding isn’t always consist, although that is a bit strange considering the persistence of the problem. A good way to test this would be to generate more waypoints along the path. This way you can see exactly how the NPC is interpreting the path and whether it’s just that single computed path causing the weird pathfinding, or if the system is behaving strangely overall.

4 Likes

It is and I know it is because Zombie Arena has pathfinding problems too and it’s made by professional Roblox Developers

2 Likes

Likely has to do with A* oversights when using navmeshes. You could possibly try increasing the agent radius, but that can often lead to other problems. You could put an invisible extra part extending the wall a bit that only the pathfinding agent (or agents) can collide with using collision groups and that might work as a fix.

2 Likes

Create an invisible wedge that affects the navmesh, and place it up against the wall. Change its material to one that you can set the cost to inf.