#YSort Not Working Properly When Player Walks Behind Objects (Godot 4.4)

4 messages · Page 1 of 1 (latest)

inner fog
#

Hi everyone! I'm currently developing a top-down game in Godot 4.4, and I'm facing an issue related to Y-sorting and the visual layering of objects in the scene — specifically how the player should appear behind or in front of environment objects like a saloon counter.

I’ve tried implementing these objects both as Sprite2D nodes and also using TileMapLayer, but the issue persists in both cases.

Here’s the problem:
When the player walks in front of an object (like a counter), everything looks correct — the player appears in front. But when the player walks behind the same object (from the top side, as you'd expect in a top-down perspective), the player still appears in front of it, instead of being visually hidden behind it.

I’ve made sure that:

All relevant nodes (player and objects) are YSort.

The YSort is enabled on the parent and relevant child nodes.

I tried adjusting pivot points and origins, but that didn’t help.

I tested using both Sprite2D and TileMapLayer setups — neither solved the issue.

Is there something I’m missing? Do I need to split environment objects into parts (e.g., a lower section and an upper section for proper layering)? Or is there a best practice for handling this kind of object overlap in a top-down game using Godot 4.4?

Any help or pointers would be really appreciated. Thanks a lot in advance!

burnt acorn
#

The player shouldn't have y sort enabled

#

That means that the sprite will get sorted separately

#

Same with any object scenes