Getting unexpected world_to_map results

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ondesic

I have a TileMap with cells 40x40 pixels. The tile origin is top left. So (0,0) through (39,39) should be cell (0,0)

I would expect world_to_map(Vector2(0,0)) to return cell (0, 0), which it does.
I would expect world_to_map(Vector2(39,39)) to return cell (0, 0), which it does.
I would expect world_to_map(Vector2(40,40)) to return cell (1, 1). However, it also returns cell (0, 0).

world_to_map(Vector2(41,41)) finally returns cell (1, 1).

That means the cell (0,0) is considered 41x41 pixels. Is there a setting I’m missing?

:bust_in_silhouette: Reply From: jobax

Might have something to do with any filters for the material used for that tile if you’re using it.

there are no materials on the tiles. I created a simple function that returns the correct coordinates. There must be a bug here.

ondesic | 2018-04-07 20:56

I see, that is weird. Sounds like a bug to me.

jobax | 2018-04-08 01:28