-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect world point in isometric map #5781
Comments
Have any of you managed to solved for or work around this? This kind of entirely breaks selecting things on an isometric map :/ |
Don't know exactly why but by removing 50 to pointer.worldX the result is correct...
(My tiles are 52px height and 100px width, maybe the value is related) |
This issue has been mentioned on Phaser. There might be relevant details there: https://phaser.discourse.group/t/gettileatworldxy-selects-wrong-tile-on-hex-maps-from-tiled/11643/2 |
Maybe pointer can be offset like this: this.input.on(
Phaser.Input.Events.POINTER_UP,
(pointer: Phaser.Input.Pointer) => {
const { worldX, worldY } = pointer;
const searchedWorldX = worldX- map.tileWidth / 2;
const searchedWorldY = worldY- map.tileWidth / 2; // note tileWidth and not height
const foundTile = this.tilemapLayer.getTileAtWorldXY(
searchedWorldX,
searchedWorldY
) as Phaser.Tilemaps.Tile;
// ... |
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
@photonstorm When will this be released? Isometric grids are all but broken for interactivity with this bug, and I see the last stable release was ~2 years ago. |
It was fixed 4 months ago. Whatever Beta release of 3.60 was published back then (plus all since) |
ohh, gotcha, the beta releases. My bad, thanks. |
Is this bug still active ? I've set a codepen here, open the console and click on the tile up - it will say undefined. The tile under (which should be 1, 1), returns that it is located at 0, 0.... It feels like the tilemap is offset by tile still ? |
@DitaXoXo https://codepen.io/samme/pen/VwONVoL?editors=0010 looks correct in v3.80.1. |
I'm using almost the exact same code. It took me days to figure this out.
I can't recommend doing this as it'll probably have consequences for anything else that references baseTileHeight. |
Version
3.55.2
Description
When trying to grab a tile under the mouse pointer, there is some offset grabbing the wrong tile.
Example Test Code
The text was updated successfully, but these errors were encountered: