getTileAtWorldXY() selects wrong tile on hex maps from Tiled

Hey folks,

Been looking at this for hours and can’t figure out if I’m doing something wrong. I made a minimal example to reproduce - it adds a tint to the hex currently under the mouse, and loads the hexagon tile map example that is packaged with the Tiled map editor.

As you can see in the image, the “selected” tile is offset considerably from the point of the mouse.

Here’s a repo for the minimal repro

All the code is basically in this file:

1 Like

:wave:

I believe the shape it’s responding to is a square as well, instead of a hexagon. This, in combination with a couple other things (below) make hexagon tilemaps prettymuch unusable :frowning:

  • getTileAtWorldX() always returns 0
  • once scaled, getTileAtWorldXY() returns even crazier answers