This may seem like an odd question, but is is possible to get a path that has the least amount of turns possible? So basically, this is for a snake type game. So lets say the object is at a 45 degree angle from the snake, like 5 units up, and 5 units to the left, instead of constantly making small movements then turning to angle across the distance, I’d rather have it go up 5 units and to the right 5 units, or something similar, just utilizing the least amount of turns possible.
Thanks
There is no direct support for it because of the way the system is designed. It cannot represent that type of queries.
However you can get quite close by changing the heuristic to Manhattan (A* Inspector -> Settings -> Heuristic) and upping the heuristic scale to something like 1.3 or 2 (some small value greater than one). Hm… ok, I notice a bug in my code, the heuristic scale is not exposed for the Manhattan heuristic even though it should be. You can cheat a bit and first select Diagonal Manhattan, change the heuristic scale, and then change back to Manhattan.
Changing the heuristic scale implies that the paths you get might not be entirely optimal anymore, so set a value as low as possible so that you still getting few turns to keep it close to the optimal.
Thanks, that actually works perfect.