Player walking below another sprite, but behind when above

Godot Version

4.3

Question

Hey!

I had this small issue where my Player would walk successfully walk behind the plant as demonstrated here:

However, when walking in front of the plant the player would be under the plant.

I have Y-Sort enabled, without it the plant becomes static and I can walk on top of it. Both the plant and the player are on the same index. Any ideas that can lead me to an answer?

Thanks in advance!


Other image as I cannot put two embeds inside of a post.

You need to have the correct origin in both nodes for y-sort to work. It should be at the feet of the character and at the bottom of the plant

Both the plant and the player are at the origin.

Which node there is the root node of the player?

That’s not correct. The origin should be at the feet of the player. Keep the root of the player’s scene at 0,0 and move everything up (sprites, areas, collision shapes,…) until the feet of the sprite is in the intersection between the red and green lines. Do the same to the plant or change the y sort origin of the tile if it comes from a tileset.