You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows 10
GLES3
Nvidia GeForce RTX 2060 with Max-Q design (laptop)
Issue description:
If you configure an Area2D to emit the body_shape_entered (or exited) signal when it collides with a TileMap that has y sorting enabled the 'body_shape' parameter of the body_shape_entered method will always be 0 (as opposed to the index of the tile in the TileMaps.get_used_cells() array).
I do not know if this is expected/supported behavior.
unrelated context as to how i found this bug
I was trying to make a demo game involving a hexagonal grid based tilemap and was happily coding it such that the tilemap has a halfoffset for the hex tiles etc..., when I realized that instead of doing the whole rigmarole of calculating where the hex tile is compared to the underlying grid (see: https://godotengine.org/asset-library/asset/406) I could instead cheat by using collisions. Since this would only be a demo i figured I could cheat a little, and to my amazement it worked. five lines of code and Bam! I had it such that the tiles would detect the mouse. This works flawlessly, until suddenly it didn't (as usual). After some debugging I realized that the y-sort variable breaks my method of detecting which tile in the tilemap had collided.
Steps to reproduce:
Create a Node2D
Add a TileMap child
Add a Area2D with a CollisionShape2D
In the TileMap, add a tileset.
Add a New Single Tile to the tileset and give it a region and a collision shape (whole area, or partial area)
Paint at least 2 tiles into the world
Connect the body_shape_entered signal of the Area2D
you should see:
body_shape: 2
body_shape: 1
body_shape: 4
body_shape: 5
body_shape: 7
or some variation
then go back into the project and check the option Y Sort (property cell_y_sort) in the Tilemap
run the program and mouse over the tiles
you should see:
body_shape: 0
body_shape: 0
body_shape: 0
body_shape: 0
body_shape: 0
Minimal reproduction project:
I attached a minimal reproduction project. Hopefully it works for you. Sorry if I wasn't descriptive enough at any point, I've never done something like this before. If this is actually intended behavior I would appreciate a link so that I could remedy my ignorance. temp.zip
The text was updated successfully, but these errors were encountered:
Godot version:
Godot 3.3-stable
OS/device including version:
Windows 10
GLES3
Nvidia GeForce RTX 2060 with Max-Q design (laptop)
Issue description:
If you configure an Area2D to emit the body_shape_entered (or exited) signal when it collides with a TileMap that has y sorting enabled the 'body_shape' parameter of the body_shape_entered method will always be 0 (as opposed to the index of the tile in the TileMaps.get_used_cells() array).
I do not know if this is expected/supported behavior.
unrelated context as to how i found this bug
I was trying to make a demo game involving a hexagonal grid based tilemap and was happily coding it such that the tilemap has a halfoffset for the hex tiles etc..., when I realized that instead of doing the whole rigmarole of calculating where the hex tile is compared to the underlying grid (see: https://godotengine.org/asset-library/asset/406) I could instead cheat by using collisions. Since this would only be a demo i figured I could cheat a little, and to my amazement it worked. five lines of code and Bam! I had it such that the tiles would detect the mouse. This works flawlessly, until suddenly it didn't (as usual). After some debugging I realized that the y-sort variable breaks my method of detecting which tile in the tilemap had collided.
Steps to reproduce:
Create a Node2D
Add a TileMap child
Add a Area2D with a CollisionShape2D
In the TileMap, add a tileset.
Add a New Single Tile to the tileset and give it a region and a collision shape (whole area, or partial area)
Paint at least 2 tiles into the world
Connect the body_shape_entered signal of the Area2D
Add a script the the Area2D:
Run the program and mouse over the tiles
you should see:
body_shape: 2
body_shape: 1
body_shape: 4
body_shape: 5
body_shape: 7
or some variation
then go back into the project and check the option Y Sort (property cell_y_sort) in the Tilemap
run the program and mouse over the tiles
you should see:
body_shape: 0
body_shape: 0
body_shape: 0
body_shape: 0
body_shape: 0
Minimal reproduction project:
I attached a minimal reproduction project. Hopefully it works for you. Sorry if I wasn't descriptive enough at any point, I've never done something like this before. If this is actually intended behavior I would appreciate a link so that I could remedy my ignorance.
temp.zip
The text was updated successfully, but these errors were encountered: