Hello everybody !
Using the TileMap node, I've been running into an unexpected behavior of the world_to_map and map_to_word functions.
I expected, when translating map coordinates into world coordinates and back into map coordinates, to come back to the same cell. Well, usually, it's the case. But here is an example where it is not true.
Here is my test project : 1 scene with 1 TileMap node with cell size set to (170, 170) and the following GDScript attached to it :
extends TileMap
func _ready():
var map_test_pos = Vector2(1, 1)
var world_test_pos = map_to_world(map_test_pos)
var back_to_map = world_to_map(world_test_pos)
print("map_test_pos = ",map_test_pos,
"; world_test_pos = ", world_test_pos,
"; back_to_map = ", back_to_map)
Here is the output I get :

I come back to cell (0,0) instead of (1,1). With many different cell sizes, it works as I expected but I also noticed this behavior with cell size set to (107,107).
My question is : should we consider this as a bug, or did I do something wrong, or are my expectations not right ?