Finds the lowest-cost path between two hex cells using A*.
Returns an array of HexCoord from from to to (both inclusive),
or null if no path exists.
The costFn is called for every candidate step. Return Infinity to mark
a transition as impassable. Close over your HexMap inside the function —
the library does not read terrain data directly.
The smallest cost your MoveCostFn can return. Scales the A* heuristic so
it never overestimates. Default 1 — if your cost function can return
values below 1 (e.g. cheap roads at 0.5), pass that minimum here or the
returned path may not be optimal.
Finds the lowest-cost path between two hex cells using A*.
Returns an array of
HexCoordfromfromtoto(both inclusive), ornullif no path exists.The
costFnis called for every candidate step. ReturnInfinityto mark a transition as impassable. Close over yourHexMapinside the function — the library does not read terrain data directly.Example