How do I know if there is no path possible to arrive at target?

Hello I have a question

As I can know if there is no possible way. Is there any function that detect it?
I saw that “IsPathPossible” might help, but what is not are the parameters “GraphNode” … or how to use them and I can not access that function through the interface code.
How should I do it?

regards

Hey!

Try something like this:

//set your constraints on a new instance for distance, graphmask …etc
NNConstraint pathConstraint = NNConstraint.Default;
GraphNode node1 = AstarPath.active.GetNearest(sourcePosition, pathConstraint).node;
GraphNode node2 = AstarPath.active.GetNearest(targetPosition, pathConstraint).node;
bool canReach = (node1 != null && node2 != null && PathUtilities.IsPathPossible(node1, node2));

1 Like

Hi
thanks for answering. I’ll try what you say these days and tell me how it went. regards