Skip to content
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

YSort in TilemapRenderSettings gives same z value for all tiles in a layer #492

Open
PraxTube opened this issue Dec 5, 2023 · 1 comment

Comments

@PraxTube
Copy link

PraxTube commented Dec 5, 2023

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:

two-pots

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.

image

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.

@StarArawn
Copy link
Owner

Y-Sort here is primarily used for isometric tilemaps. I haven't tested to see if this works well with other types of map configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants