Trouv / bevy_ecs_ldtk

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
Other
687 stars 79 forks source link

Rectangular tile index incorrect when not a multiple of tile width/height #105

Closed timkurvers closed 1 year ago

timkurvers commented 2 years ago

This seemingly occurs when a rectangle of tiles is chosen for an entity, and the offset of this rectangle is not a multiple of the tile width or height.

Most likely a floor-vs-ceil issue in #[sprite_sheet_bundle], but I am not super familiar with the intricacies involved here.

More than happy to provide a reproduction case if required.


Compare this LDtk screenshot:

Screenshot 2022-08-07 at 10 14 01

With the bevy_ecs_ldtk rendered result (both entities on the right are off by one column and row respectively):

Screenshot 2022-08-07 at 10 14 15
Zak0749 commented 2 years ago

For your tilesets are you using any spacing/padding? That causes me issues sometimes

timkurvers commented 2 years ago

For your tilesets are you using any spacing/padding? That causes me issues sometimes

No spacing/padding on the tileset.

Only difference between the entities is the rectangle selection (as far as I can tell):

Screenshot 2022-08-07 at 10 13 38 Screenshot 2022-08-07 at 10 13 50
Trouv commented 2 years ago

Thanks for the issue. I don't think using selecting a rectangle for the entity visual was a use case I was targeting when writing this plugin, so it makes sense that it doesn't quite work. I'm actually kind of surprised that it almost works now.

I agree, it's almost definitely a ceiling vs floor issue.

Since this isn't explicitly supported, I've changed this from a bug to an enhancement, and removed it from the 0.4 milestone.