Separate the ysort of a StaticBody2D into two separate pieces

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

I have a sideways bridge that has railings on the front and back. I need my player to be able to appear to be behind the front railing of the bridge, while appearing to be in front of the rest of the bridge (middle and back railing). My solution that I have implemented (and it works) was to separate the front railing into it’s own StaticBody2D and to place it in the correct position on the rest of the bridge. I was not able to put the front railing as a child of the bridge, because then my player would not be sorted with it. While the solution I have does work, it seems really hacky and I would like to know if there is a better way to complete this. Thanks!

Have you tried changing the z-index in the [Inspector] tab?

bloodsign | 2021-02-11 23:09

Changing the z-index of what? If I change the z-index of the bridge I would either always be in front or behind the entire thing.

graytaylor0 | 2021-02-11 23:45

:bust_in_silhouette: Reply From: ClumsyDog

I haven’t watched this, but it may have the answers you’re looking for: It’s a devlog about adding bridges to a top-down RPG game. Sorry if this wasn’t helpful.