Path always returns true & character walk through obstacles

I’m trying to understand why, in the AstarAI.cs script -> OnPathComplete never returns errors true even if the target node shouldn’t be reachable (target node itself is unwakable/red, or target node is surrounded by blocked nodes and no connections exist).

If the target position can be reached then obstacles/unwalkable nodes get avoided as they should, but if the path should technically not exist, the above phenomenon occurs.

This should Solve your problem:

`
//Checks if a path is not blocked by using A*'s .IsPathPossible Method… AstarPath.active.GetNearest gets the Nearest Node to the Start and end points
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);
	}
}`

Thanks it worked. Alhtough I can still move to onto a blocked node, is there any way to get a node with Vector3 coordinates to check if it’s walkable? Then I could use the Vector3 position I’m pointing at with the mouse cursor to check if the corresponding node is walkable, and if not, send no move command.

Hi

The script will always try to find the closest node to the target it can still find a valid path to. You can set the max distance lower if you do not want that. See A* Inspector -> Settings -> Max Search Node Distance (or similarly named setting).

Also, try setting Seeker->Start End Modifier -> End Point to ClosestOnNode. This should fix the issue of the path leading into obstacles at the end.

The Seeker -> End Modifier -> End Point on Closest Node did the trick! Thank you!