Y-Sorting with multiple Z layers

Godot Version

Godot 4.3 beta1


I am making a 2D top down game utilizing layered tilemaps for the game world. I have otherwise succeeded in player interaction with this environment other than y-sorting with these many layers. The player currently sorts correctly with tiles on the same z-layer and on higher z-layers, but the player’s feet sort behind the tiles on lower z-layers. The issue is illustrated below:


The reason this problem happens is because separation between tilemap layers is done by changing the y-sort offset by 16 per layer, as this is my tile size. However, this does not result in correct behavior for the ground. I have also considered incrementing the “z-index” property of different z-layers, but this once again breaks interaction with higher layers as can be seen below:

Screenshot 2024-06-08 083113

What would be a smart way to approach this problem? Some ideas I have are:

Never used 2d tileset. But the issue kind of looks like your character sprite offset could be adjusted so the feet are at the y sort threshold.