-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Overlapping tiles in TileMaps with Y Sort enabled under a Y Sort node randomly changes rendering order #33230
Comments
Discussed this with reduz on IRC:
|
I've just encountered this issue in a project I'm working on, and I'm not sure if the stable sort suggested is sufficient for the behavior that I expected. I've modified the original reproducer (by swapping the order of the layers) to show what I'm talking about more easily: TileMap.Y.Sort.Overlap.Layers.DEMO.zip With Y Sort disabled, all of the red tiles render above the green tiles, reflecting their order in the scene tree: With Y Sort enabled, the order is random, as reported by @AtomaFajrovulpo: Would it make sense to check the index or Z-index instead of the X coordinate when the Y coordinates are equal? I think that would result in more predictable behavior, and would allow for different tile maps to act more like layers. |
After playing with this some, I realized that my original suggestion to use Z-index as a tiebreaker doesn't make sense. But tracking the order in which YSort nodes collect their children seems to work: https://github.com/Pennycook/godot/tree/3.2-stable-ysort. @bojidar-bg: Does this look reasonable to you? Should I open a pull request? |
As discussed on IRC with @reduz, this seems to be a good solution indeed. Please open a PR against the |
Godot version:
3.1 stable and 3.2 alpha 3
OS/device including version:
All
Issue description:
Having two or more TileMaps under a Y Sort node with overlapping tiles and when both have Y Sort enabled results in them randomly changing their rendering order, in the editor or whilst playing the game.
Steps to reproduce:
Create a V Sort node, add two TileMaps, both with V Sort enabled, create overlapping tiles.
Minimal reproduction project:
TileMap Y Sort Overlap DEMO.zip
The text was updated successfully, but these errors were encountered: