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
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.