Pathfinding randomly returns NoPath when the agent is stuck to a wall

When moving the agent using Humanoid:MoveTo and gets stuck into a wall, using Pathfinding to try and unstuck it, sometimes fails to calculate a path despite being easily avoidable.

My Agent:

local PathFindingAgent = {
    AgentCanJump = false,
    AgentCanClimb = false,
    Costs = {
        Water = math.huge,
    },
    PathSettings = {
        SupportPartialPath = true,
    },
}

Expected behavior

It should be able to calculate the path and go around

image

A private message is associated with this bug report

2 Likes

Have also noticed this error occurring.

1 Like

Do you have this feature turned on?

It happens with both enabled and disabled. The recording was done with the feature off.

* Side note: We had to disable it because we suspected it was causing random server crashes (we’re still investigating and waiting to confirm, but all evidence points to that)

A pretty good workaround is to set AgentRadius in the agent parameters to a stud or two bigger than the rig’s actual hitbox width, so it avoids going that close to walls in general (which also makes them less likely to rub against the wall while moving along it). My guess is that the default value of 2 makes it believe there isn’t a direction it can move without still being blocked by the wall.

It would also help if you posted a screenshot/video of this bug with the Pathfinding Mesh / Pathfinding Links visualizations enabled so we can see the path it follows before getting stuck in the wall and see if the mesh around the path blocker agrees with the actual blocking hitbox.

Hello!

As stated in the original post, the pathfinding only turns on once the bot falls behind and lose sight of the target (gets stuck), before that it uses a basic Humanoid:MoveTo, which results in the bot getting that cloes to the wall and causing this bug.

The reason we don’t use Pathfinding all the way is that every players have 20 bots in servers up to 30 players, meaning up to 600 bots can calculate the path at the “same” time

Hello @oldmannt, I saw your post in Patchfinding returning nil even with ImprovedSearch feature enabled - #4 by oldmannt, it looks like this might suffer from the same or similar problem.

I can provide a repo place if the code in private message is not enough.

Thanks