PathUtilities.IsPathPossible always returns true

I am using PathUtilities.IsPathPossible before setting the destination of my wandering AI, but they are still picking position that are not reachable (blue circle gizmos):

Im I doing something wrong?

Generating a random point in a radius:

public Vector3 GenerateRandomPoint()
    {
        Vector2 point = Random.insideUnitCircle * radius;
        Vector3 dest = new Vector3(point.x, 0, point.y) + transform.position;

        return dest;
    }

Checking if point is reachable:

public bool IsPathPossible(Vector3 destination)
    {
        GraphNode node1 = AstarPath.active.GetNearest(unit.transform.position, NNConstraint.Default).node;
        GraphNode node2 = AstarPath.active.GetNearest(destination, NNConstraint.Default).node;

        return PathUtilities.IsPathPossible(node1, node2);
    }

    public void Enter()
    {
        var point = area.GenerateRandomPoint();

        if (!IsPathPossible(point))
            Debug.Log(unit.gameObject.name + " just set an unwalkable path");
        else
            SetDesitnation(point);
    }

In the above code, IsPathPossible never returns false.

Hi

One thing I can see is that you are using NNConstraint.Default. This will make it search for the closest walkable node. So if your destination was in the middle of the lake it would still find the closest point on the shore. Try using NNConstraint.None instead, which will return the closest node regardless of if it is walkable or not.

Thanks,

This seems to work:

public Vector3 GetNearestWalkableNodePos(Vector3 origin)
    {
        GraphNode node = AstarPath.active.GetNearest(origin, NNConstraint.Default).node;

        Vector3 nodePosition = (Vector3)node.position;

        return nodePosition;
    }