phaserjs / phaserjs/phaser

getTileAtWorldXY does not appear to be accurate for staggered isometric maps

Open
#7,144 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🗺️ Tilemap
Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

Version

  • Phaser Version: 3.88.2
  • Operating system: Windows 11
  • Browser: NA

Description

When using a staggered isometric tiled json map the getTileAtWorldXY appears to be providing incorrect results. This works fine for the non staggered version. Expected behavior is that when I provide the current mouse x,y then the tile I get would be the one directly below the mouse.

Example Test Code

I used the demo example but changed the map to be staggered. I included code to tint the currently hovered over tile which should show that the wrong tiles are being tinted.

https://phaser.io/sandbox/8tBaWm2s

Additional Information

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked Phaser sandbox and compare the hovered-tile results for staggered and non-staggered maps. Then trace getTileAtWorldXY through the tilemap coordinate conversion used for staggered isometric maps. Done means the tile directly under the mouse is returned and tinted consistently in the provided example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.