3
\$\begingroup\$

I am trying to use Y-Sorting on a tilemap tree to Y-Sort the whole tree, but it is Y-Sorting each tile of the tree instead of the tree as a whole:

player character being sorted behind some tree tiles and in front of others

I have tried adjusting the Y-Sort Origin but that didn't work. I am trying to make the tree render completely over the Character when he's behind and below when he's in front.

\$\endgroup\$
5
  • \$\begingroup\$ Do you have Y-Sorting enabled for both the TileMap itself and the tilemap layer that holds the tree? Do the TileMap, the tilemap layer with the tree and the character all have the same Z index? \$\endgroup\$
    – Pikalek
    Commented Aug 31, 2023 at 15:54
  • \$\begingroup\$ Also, you need to leave a blank line between your question post body & the image lookup info (i.e. before the line [1]: https://i.sstatic.net/abcdef.png or whatever) for the image to render correctly in your post. If you remove it, renders as a unresolved markdown text & link instead. Refer to the edit link under your post to see what I mean. \$\endgroup\$
    – Pikalek
    Commented Aug 31, 2023 at 15:59
  • \$\begingroup\$ @Pikalek thank you for that advice. Also Yes I got both Y-Sorting enable and they are on the same Z Index. I just realized I didn't word this question good and will edit it. The tiles are sorting correctly, but I want the whole entire tree to Y-Sort at the same time instead of each indivisual tile of it. \$\endgroup\$ Commented Aug 31, 2023 at 16:05
  • \$\begingroup\$ Yes, that info changes things & you should definitely edit to reflect that (comments don't always get read so other might not notice you've mentioned the info down here). Offhand I'm not sure there's a simple way to have a group of tiles sort as a composite unit. I've seen some folks use special tiles to dynamically spawn in other scenes - it might be possible to use such a tile to mark the base of the tree & add the rest separately, but it's not a technique I've tried myself yet nor am I sure how well suited it is to your situation. \$\endgroup\$
    – Pikalek
    Commented Aug 31, 2023 at 18:52
  • \$\begingroup\$ @Pikalek Okay! Thanks for you help! \$\endgroup\$ Commented Sep 1, 2023 at 1:15

1 Answer 1

0
\$\begingroup\$

You should be able to adjust the Y-Sort Origin of the top tiles to be at the same y position as the bottom tiles. That way all four tiles will get y sorted the same and behave the same relative to the player.

So if your tiles are 64px tall, then set Y-Sort Origin for the top to be -32 and the bottom two to be 0.

(You mentioned adjusting the Y-Sort Origin, but it's not clear what didn't work. Hopefully this is helpful.)

\$\endgroup\$
1
  • \$\begingroup\$ Thanks so much!!!!! \$\endgroup\$ Commented Oct 18, 2023 at 3:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .