Bug Related to Isolated Areas by NavMeshCut

  • A* version: 5.2.5
  • Unity version: 6000.0.26f1
  • Recast Graph, FollowerEntity, NavMeshCut, NodeLink2

There are cases where isolated areas are created due to NavMeshCut. The issue is that these isolated areas return IsPointOnNavMesh = true, making them appear accessible. However, when setting such areas as ai.destination, it triggers the error:
Path Failed, Error: Searched all reachable nodes, but could not find target.

Interestingly, if a non-isolated destination is selected, the AI passes through the isolated area as part of its path.

This problem seems to occur when the isolated area is small. If the isolated area is relatively large, the issue does not appear.

Please refer to the video below for better understanding:
Video of “Bug Related to Isolated Areas Caused by NavMeshCut”

Is this a bug? If not, is there any solution for this issue?

Hi

Would it be possible for you to post a screenshot of your graph when this happens, together with A* Inspector → Settings → Graph Coloring set to Areas?

IsPointOnNavmesh just tells you if the point lies on the navmesh, not if that part of the navmesh is accessible from some other part of the navmesh. For that you’ll need IsPathPossible - A* Pathfinding Project

Video Set Graph Coloring to Areas
Here’s the requested video.

Also, I am using IsPathPossible as well.
First, I use isPointOnNavMesh for an initial check, and if it passes, I proceed to check with IsPathPossible.

The pink box highlighted in the video indicates that the process has been successfully completed.
However, it cannot actually be set as a destination (though passing through it is possible).

Below is the related code:

  public static bool IsPointOnNavmesh(Vector3 point)
  {
    const float MaxHorizontalDistance = 0.1f;
    const float MaxCostSqr = MaxHorizontalDistance * MaxHorizontalDistance;
    var nearest = AstarPath.active.data.recastGraph.GetNearest(point, NNConstraintClosestAsSeenFromAboveSoft, MaxCostSqr);

    return nearest.node != null && nearest.node.Walkable && nearest.distanceCostSqr < MaxCostSqr;
  }

 public static bool IsPathPossible(Vector3 currentPos, Vector3 targetPos, int traversableTags)
  {
    GraphNode currentNode = AstarPath.active.GetNearest(currentPos, NNConstraint.Walkable).node;
    GraphNode targetNode = AstarPath.active.GetNearest(targetPos, NNConstraint.Walkable).node;

    List<GraphNode> path = new(){
      currentNode,
      targetNode
    };

    return PathUtilities.IsPathPossible(path, traversableTags);
  }

And this is my A* Inspector settings:

Strange…

Do you think you could tweak the code by changing the InaccuratePathSearch to true in the TriangleMeshNode.cs file, and see if that changes anything?

If not, would it be possible for you to share a test project with me, where I can replicate this issue?

As instructed, I set InaccuratePathSearch to true in the TriangleMeshNode.cs file.

Video Of “InaccuratePathSearch to true in the TriangleMeshNode.cs”

After making this change, it behaves as shown in the video. The issue remains the same, and now the followerEntity moves back and forth after reaching the destination.

Issue Sample Project
This is a sample project with only the essentials implemented.
You can move the followerEntity by clicking on the ground.

Could you let me know when the bug will be fixed? I’ve upgraded to version 5.3.0, but the issue is still there.

Hi

I’ve implemented a fix now. It will be included in version 5.3.1.

1 Like

It works properly. Thank you!

1 Like