Bool IsPathEnable(GridNode A, GridNode B)

Hello.

I need a method to know if there is a path enable between two nodes. I don’t need to follow the path, only to know if it is posible.

What is the best way to do this?

It has to be very simple but I do not find the correct way. I guess is with Seeker.

Thank you

I found it!
PathUtilities.IsPathPossible (Node n1, Node n2)

Thank you!

Sorry its a little late: But this is what you want

`
public bool CheckIfPathIsPossible(Vector3 PathStart,Vector3 PathEnd){
		
		Pathfinding.Node node1 = AstarPath.active.GetNearest(PathStart, NNConstraint.Default).node;
		Pathfinding.Node node2 = AstarPath.active.GetNearest(PathEnd, NNConstraint.Default).node;
		
		if (!Pathfinding.PathUtilities.IsPathPossible (node1,node2)) {	
			
			return(false);
		}
		else{
			
			return(true);
		}
	}`

Thank you very much. Now I need another feature. I need to know the distance between node1 and node2. We could say the “path length”.

Any idea? Can I do both checks with the same call? And thank you again.

Not Corroutine
public int PathUtilities.Steps (Vector3 PathStart,Vector3 PathEnd) { if (CheckIfPathIsPossible(PathStart,PathEnd)) { return NumStepsInPath(PathStart,PathEnd); } else { return Mathf.Infinite; } }
Context: I’m doing a Turn Based strategy game. For the AI, I need to find the posible Tiles that offer cover. So I need to check if I there is a path to get to the tile and if the distance is less than the action points that the AI has

Hi

What you are looking for is the ConstantPath.
What it does is to start at some position, then it searches outwards until the paths to the nodes become longer than a specified limit. It then returns all the nodes.
If you have the pro version, there is an example scene named PathTypes which show all path types, including the ConstantPath.

See http://arongranberg.com/astar/docs_FeatureFreeze/class_pathfinding_1_1_constant_path.php

For getting the number of Node’s in a path, I think Path.Node.Count should do the trick!! … If not here is the Documentation of Pathfinding.Path