Hello, does get_available_point_id is useful in AStar in general ?
I am currently doing a template for hexagonal TileMap and pathfinding (2D), but it seems I need to create my own function to calculate the id from a position, because otherwise there is no way to have a bijection from tilemap coordinates (Vector2i) and index (int). On all example I see it use a map_size, like a hashing function, to get point id from coordinates, but seems very fishy to me, since I don't care about id value, I just want to access to the point I created.
func astar_add_walkable_cells():
var cell_array = []
for coords in get_used_cells(0):
var position_cell = to_global(map_to_local(coords))
var id = astar_node.get_available_point_id()
var tile_data:TileData = get_cell_tile_data(0, coords)
cell_array.append(id)
astar_node.add_point(id, position_cell, 1.0)
return cell_array
func astar_connect_walkable_cells(cell_array):
for id in cell_array:
var point = astar_node.get_point_position(id)
for coords_neighbor in get_surrounding_cells(point):
# Here no idea how to retrieve the id from position without closest_point (that would be algorithmically wrong)
...
astar_node.connect_points(id, neighbor_id, false)
Seems so get_available_point_id is useless, and I would want to know in which context it can be useful ?