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

Rules based tiles don't use pivot #152

Open
janos-r opened this issue Jan 11, 2023 · 1 comment · May be fixed by #162
Open

Rules based tiles don't use pivot #152

janos-r opened this issue Jan 11, 2023 · 1 comment · May be fixed by #162

Comments

@janos-r
Copy link
Contributor

janos-r commented Jan 11, 2023

LDtk: 1.2.4
bevy_ecs_ldtk: 0.5
bevy: 0.9

Issue:
The pivot used in LDtk editor for autotiled sprites is not respected in the library, which is visible when used with sprites more than 1 tile big. The pivot used in the library is equal as if all pivot in rules-based tiles was set to the bottom-right corner.

Example:
scrnshot from the current unchanged platformer example, inside the LDtk editor:
Screenshot from 2023-01-11 18-28-59
The rule is always based on the center grid.
Screenshot from 2023-01-11 18-25-08
It is shown on the map with a violet frame. The pivot says that the picture of this gray shelf should be in the middle of that frame, but this pivot is not respected in the actual loaded game with the library:
Screenshot from 2023-01-11 18-29-42
The shelf is drawn one grid to the left from where it should be.

In this situation it is not a big issue in the case of platformer, where autotiles are used as random scatters, but this is a big issue when
a) it is either important to be precisely aligned with the surroundings
b) when the concerned intGrid has other effects, like collision. If this shelf had collision, the player would bump into the empty space next to the shelf.

Example from my own project where the auto tiles are drawing trees and stumps.
Screenshot from 2023-01-11 18-31-17
Not only are they visually not in the right alignment with the fences (the fences just one tile big, so this issue doesn't apply to them), but when used with collision, the player would collide with the grid (as desired) but the tree sprite is somewhere else.

I can workaround this by redoing the auto-tiles as objects, but this should be fixed if somebody can find the cause, or introduce the feature to the library. It would be impossible to properly use auto-tiles bigger than one tile.

I hope my explanation was clear.
Thanks to anybody working on this amazing library and anybody helping out!

@Trouv
Copy link
Owner

Trouv commented Jan 13, 2023

Thanks again for another detailed report. This has been an issue since the beginning that originally would've been nasty to support. I think it might be much more reasonable to implement now thanks to bevy_ecs_tilemap's rewrite, but I'm not 100% sure.

@geieredgar geieredgar linked a pull request Jan 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants