bevy_ecs_tilemap
bevy_ecs_tilemap copied to clipboard
YSort in TilemapRenderSettings gives same z value for all tiles in a layer
Using ysort in #489 gives me the same value for all tiles in the same level. I don't know if this is intentional or if it worked differently in previous versions, but to me that seems wrong. The issue is the transform.translation.y
, which is the y
value of the level, not of the tile.
Example:
Two pots that would definitely result in a different y sorting:
results in the following print
2023-12-05T09:12:58.686386Z INFO bevy_ecs_tilemap::render::material: y, z: (1032, 1), map/tile y: (64, 16), final z: 0.9921875
2023-12-05T09:12:58.703052Z INFO bevy_ecs_tilemap::render::material: y, z: (1032, 1), map/tile y: (64, 16), final z: 0.9921875
where I simply added this info.
info!(
"y, z: ({}, {}), map/tile y: ({}, {}), final z: {}",
transform.translation.y,
transform.translation.z,
chunk.map_size.y,
chunk.tile_size.y,
z
);
The y values are clearly not different (which I would have expected). If I use a different layer then the y value is different, so it's using the y values of it's parent and not of the actual tile. We get the following print for this constellation.
2023-12-05T09:20:11.074285Z INFO bevy_ecs_tilemap::render::material: y, z: (1032, 3), map/tile y: (64, 16), final z: 2.9921875
2023-12-05T09:20:11.074326Z INFO bevy_ecs_tilemap::render::material: y, z: (1032, 2), map/tile y: (64, 16), final z: 1.9921875
2023-12-05T09:20:11.074345Z INFO bevy_ecs_tilemap::render::material: y, z: (1032, 1), map/tile y: (64, 16), final z: 0.9921875
Note that I am using bevy_ecs_ldtk
to interfact bevy_ecs_tilemap
, so the issue might be related to that.