Y-Sort Issue (Godot 4)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SpaceAttorney

I have the player character in a room with another object, both with Y-sort enabled. The object’s y-position is 189 px, but the player doesn’t render in front of the object until their y-position crosses 219 px or so. Any ideas why this would be the case?

:bust_in_silhouette: Reply From: SpaceAttorney

Never mind, I figured it out. I was just misunderstanding how y-sort works in Godot 4.

Basically, the “Y Sort Enabled” option doesn’t tell a node to let itself be y-sorted, but rather to y-sort its children. I had it enabled on the player and object, so Godot was just y-sorting their sprites based on their own positions instead of the parent nodes’ positions.

1 Like