A* Pathfinding Project

Limit range for calculated path in a 2D grid graph


#1

Hi! Is It possible with a modifier or something to limit the range (by nodes) of a calculated path? I have an AI moving towards a given destination but it cannot reach it in one turn. I want to search to the waypoint and then cut off the nodes outside of the specified range. I tried just cutting the list from ABPath.path after it was returned from Seeker.StartPath but i could not use the cut path since it was in an incorrect state (probably since it lacked a real end node?). I have a really inefficient solution that involves multiple searches =(

Any Pointers?


#2

Take a look at the TurnBasedAI example, can be found as one of the example scenes included with the project. It would require a little bit of modification but should give you a lead.


#3

Hi

The best way is usually the best way. However you cannot modify it directly after the call to StartPath. Path requests are asynchronous so the path will not contain any information for some time. See https://arongranberg.com/astar/docs/callingpathfinding.html for more information.