- A* version: 5.3.8
- Unity version: 6000.0.58f2
I have a Grid graph with custom diagonal traversal cost (straight cost 1, diagonal cost 2). The costs are defined in a custom GridGraph.
Now, this is a turn based game and I want the enemies to be able to find the path to their targets considering their current movement points, which translate directly to the traversal cost.
Right now I have two ways of interacting the with the graph:
- ABPath: allows me to find a path to the target, but doesn’t take into account traversal costs.
- ConstantPath: allows me to find all nodes within the traversable distance.
What I want is a mix of both, an ABPath that provides the best path to the position, up to a specific movement cost.
I’m able to filter the results of the ABPath so that the movement cost is respected, but in some occasions I’m not able to fully utilize all movement points as the path is unaware of the maximum cost, so it sometimes picks diagonals when it’s not possible to move diagonally.
Is there any built in way of doing this? What’s the recommended approach?