Custom sorting tiles on TileMapLayers

Godot Version

stable 4.4.1

Question

I have two TileMapLayers, one for terrain and the other for “structures”, i.e. plants, rocks and buildings. In the hierarchy, the former is placed before the latter. (There is also a layer for shadows but that isn’t relevant for this) I have y-sort enabled on all tilemaps to allow them to have tiles that don’t fit within the grid and still render them in the correct order; this works well:


Adding a tree also mostly works as expected:

The tree is covered up by the large tiles in front of it, as it should be. However, as you might be able to tell from the image, it is covered up by all tiles in front of it, even the ones that would not obstruct the tree in real life.

This is to be expected with the current system, but it’s obviously not what it’s supposed to look like.
(This is the full tree, for reference)

Do you have any ideas how I could have tiles like the tree obstruct a few tiles in front of them (to look like in the last image) but still be blocked by others (like in the second image)?

What if you split the tree up into vertical slices that are “column” sized tiles?

1 Like

Thank you,
I don’t think vertical slices would work because placing them at the original position would still mean that they would be covered up by the terrain in front of them.

But if I make two horizontal slices, one for the top part at the original position and one for the bottom part a few tiles further down, it will look the way it should.
Top:


Bottom:
0001
Edit:
I suppose it’s better to just place the entire tree a few tiles further down, not sure why I didn’t think of that before…

1 Like