Independent nodes that you can enter but not exit

Very often in my landscape, the mesh creates independent nodes that AIPath can get into, but can’t get out of.
Is it possible to somehow remove the ability to create such spots? Or how to enable AIPath to exit from them to neighboring nodes.

Thanks

Hi

Using the erosion settings on the grid graph can be a good way to filter out such nodes.

You can also, if you want, go through all nodes manually and filter out ones that are not reachable from the player:

var playerNode = AstarPath.active.GetNearest(player.position, NNConstraint.Walkable).node;
AstarPath.active.AddWorkItem(() => {
    AstarPath.active.data.gridGraph.GetNodes(node => {
       if (node.Area != playerNode.Area) node.Walkable = false;
    }
    AstarPath.active.data.gridGraph.RecalculateAllConnections();
});
1 Like