-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: recalculate layer offset to adjust for tileset sizes (#254)
Closes #248 Currently, we adjust the adjust the transform of layer entities to account for the following: - bevy_ecs_tilemap anchoring tiles to their center (we need to cancel this out to make all layers of different sizes stack on top of each other nicely) - layer offset values However, for more niche cases of using a layer grid size that differs from the tileset tile size, this isn't sufficient. We also need to adjust the layer's transform to account for the following: - the difference between the layer size and grid size causing tiles to sink below the origin with default pivot - tiles having an in-LDtk pivot (anchor) value (which makes no difference when tile size = grid size) This PR makes these additional adjustments. It also makes some stylistic changes that I hope will make some of the mathematical logic more clear. The plugin still doesn't handle cases where tile size is not divisible by grid size. LDtk does spit out a warning in these scenarios though, so I think it is more reasonable to leave this unsupported for the time being.
- Loading branch information
Showing
1 changed file
with
58 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters