If target is not reachable(surronded by obstacles),How do I get the info?

I have a question.
If target is blocked by obstacles ,return false. If target is reachable, return true.
How the do this?

Thanks very much!

Path yourPath = new ABPath (start, end);
AStarPath.active.StartPath(yourPath);
AstarPath.active.BlockUntilCalculated(yourPath); //if you want to get result immediately.
if (yourPath.vectorPath.Count == 0)
//blocked
else
//not blocked

1 Like

You can also use https://arongranberg.com/astar/docs/class_pathfinding_1_1_path_utilities.php#a25736e29fdb41bc3f1d57abeaf2c8eef

GraphNode a = AstarPath.active.GetNearest(firstPoint, NNConstraint.Default).node;
GraphNode b = AstarPath.active.GetNearest(secontPoint, NNConstraint.Default).node;

if (!Pathfinding.PathUtilities.IsPathPossible (a,b)) {
    ...
}

Really appriciate your support…