Support Forum

Pathfinding in a restricted area

What’s the right way to limit the pathfinding to a specific area?

In my games there is an “exploration” mode and a “combat” mode.

The game switches to combat mode when the players enters a combat zone.
At that moment, all units should use a different pathfinding: one that is restricted to the zone of the combat. When the combat is finished units switch back to the pathfinding for exploration.

The combat zones are all spherical.

How should I set this up?

I have found how to do restrict the area of Grid graphs.
You can access the nodes of the grid graph and set them as walkable or unwalkable.

But this would only work for Grid Graphs, and not for Recast graphs.
I thought I could change the size of recast graphs to achieve a rectangular area restriction.
But I think recast graphs use their graph size to detect meshes in the scene. And if those meshes are bigger than the size of the graph, the pathfinding is not restricted to the graph size!
(The blue areas outside of the white rectangular gizmos are included in the scanned result. I need them to be culled out)

Is there really no way to restrict the resulting scanned area of the pathfinder for Recast graphs in this package?
Any help is greatly appreciated.

I have tested if this was the case in demos but it’s not the case.

I’m not sure what’s happening in my game’s scene then. But obviously the scan extends further than the size of the graph which seems to not be intended.

I’ll try and figure that out now.


Sorry for the late reply. Since you got an answer in [BUG REPORT] RecastGraph: scan detects outside of the bounds of the graph - #3 by JeremyV I assume this is solved now?

Yes, thanks, no problem.
It would be nice to have the fix integrated in the stable release at some point :slight_smile: