Godot Version
Version 4.3
Question
hi,
trying to move an enemy to a player on an AStarGrid2D on a TileMapLayer.
context:
var id_path = astar_grid.astar_grid.get_id_path(
tile_map_floor.local_to_map(enemy.global_position),
tile_map_floor.local_to_map(player.global_position),
true).slice(1)
print(astar_grid.astar_grid.get_id_path(Vector2(0,0), Vector2(8,8), true))
print(id_path, tile_map_floor.local_to_map(enemy.global_position), tile_map_floor.local_to_map(player.global_position))
prints:
[(0, 0), (1, 0), (1, 1), (2, 1), (2, 2), (3, 2), (3, 3), (3, 4), (4, 4), (4, 5), (5, 5), (6, 5), (6, 6), (6, 7), (7, 7), (7, 8), (8, 8)]
[](3, 1)(3, 6)
problem:
so if i insert Vector2’s in the get_id_path function, it work’s, i get an id path. if i insert the map positions of player and enemy it does not, it is empty. why?
i noticed that the allow_partial_path does also not work, because if the distance of enemy to player is higher than enemy move range the Vector2 id_path is also empty. i expected an shorten array.