Pathfinding:ComputeAsync() returning NoPath when the destination is far away

Hello everyone,

My game consists of a maze and a big NPC that chases the player.

When there is no player to chase, the NPC finds a path through the maze to return to its original position (a part in the workspace).

When the part is close to the NPC it finds a path just fine, however when its even just a little further away the function returns PathStatus.NoPath.

For Example, when trying to find a path from 1 to 2:

No path is found. But finding a path from 3 to 4:

Is possible.

The NavMesh looks fine:

Anyone had this problem before or know what could be causing this? Thank you in advance.

1 Like

this is reallly urgent! (bump)

Okay i dont know if its very clear in the image but the navmesh breaks here.
when i place the npc after the split it works fine. how do i join the mesh back together??
Also, its only on this specific part, and its full of cracks. its like every 5 studs or so

:ComputeAsync doesn’t return anything instead you need to use path itself on who you called method computeasync

Thats what im doing, sorry if i wasnt clear. My code is not the problem, i believe this is an engine bug.

1 Like

Maybe it has some invisible walls where you need to add PathfindingModifier | Documentation - Roblox Creator Hub?

No, theres nothing in the way.

What have you got set for the Agent Parameters? And when you say the NPC is big how many studs tall/wide is it?

I tested again with a regular R6 rig with default parameters and this still occurs.

After some sleep it seems like the whole navmesh erased itself.

This only happens at runtime

Is this with PathfindingUseImprovedSearch set to Enabled or Disabled in the Workspace?

Set to Default.

CHARRRRAACTER Limmimitt

Should i close this and move to the bug report?

1 Like

Try changing it to see if you get different behavior. Default I believe is still the same as Disabled, AKA old algorithm.

No changes in behavior.

carrracter loimit

How far apart are the positions? It could be failing a raw distance check.

376.1518249511719 studs apart

dawdadwdawdaw

The NavMesh is completely ruined.

The Navigation Mesh doesn’t need to be everywhere, that would be very very costly for performance. It seems like it’s trying to generate in a line from the start to the end with a certain radius, and then failing because the hallway diversions are too long.

Should I split the hallways into different parts?

For people in the future reading this:

Roblox’s NavMesh generation is limited to a 32-stud radius around the pathfinding agent’s position by default. This means if you try to pathfind to or from a location far away from the agent, the NavMesh won’t generate in those distant areas. it’s done for performance reasons.

Placing a bunch of dummy parts around your map each 32 studs from eachother and calculating the NavMesh at their position is a temporary solution:

local dummy = script.Parent

local preloadPath = game.PathfindingService:CreatePath()
preloadPath:ComputeAsync(dummy.Position, dummy.Position)

-- Wait a short time for navmesh to generate
task.wait(1)

dummy:Destroy()