Create weights for connection in A*

Godot Version

4.2.1.stable

Question

I am trying to find a solution to roads over a hex tilemap. The best I could find was a suggestion to add to the function from AStar2D

void connect_points ( int id, int to_id, bool bidirectional=true, int to_weight )

in this topic

But it just said it was a difficult task.
Does the to_weight exist somewhere in AStar that I don’t see or is this still a missing link?

If I wasn’t fully clear above, I have a hex map and all of the hexes are connected. I could put weights for the hex itself but that doesn’t include road connections, or specifically hex-sides. It would be great if we could connect points with a weight (e.g., roads) or tell each tile side what the cost is to cross it.

1 Like