A* Pathfinding Project

Seeker draws a path gizmo when destination is reachable, how could i get to the same conclusion?


#1

Hi There!

I am making a strategy game and sometimes the player or the AI happens to set a destination on the Grid Graph that is unreachable because it was deamed not walkable when the graph was scanned.

Which leads to one of two scenarios 1., the agent doesn’t moves at all 2., the agent moves but it is if like it was not sure what it wants to do. Anyhow the behaviour is not important but rather is my inability to gauge in code if the path to destination is “green” and good to go.

This is where the seeker’s path gizmo comes in, to debug the situation in case when the agent doesn’t seam to move or is moving in a funky way i use the gizmo to see what is going on. And in all of these cases the gizmo draws nothing but only when i change the destination to an unmistakably reachable and walk able position.

I would like to know how to determine if the path is walk able just as the seeker does so to draw the path gizmo.

I know use the IsPathPossible utility function, but i do not know how, i could not find a specific code example showing how to get the this functions parameters! I do not get it what nodes it wans, how to get nodes…

I just want to know if the destination is reachable by the path is been generated, if not i take care of resting the destination to try again!

Thank you for your time!


#2

Never mind i found it, but i must say it was confusing the name of the function gives the idea to pass the path and get the result not to get the nearest node, one of current position and the one of the destination.

Well it works now :stuck_out_tongue:

https://arongranberg.com/astar/docs/old/using-nodes.php