0
\$\begingroup\$

I watched the video: https://www.youtube.com/watch?v=60rpO_0CJII

Why is the character able to move behind the chair? I understand that it's thanks to Y Sort, but it seems to be applied to the entire chair. If it is applied to the entire chair(Around 1:14), I don't understand why the character can move behind the upper half of the chair. It feels like the character should be able to move behind the entire chair.

What kind of settings allow the character to move behind only certain parts of the chair while preventing them from moving behind others?

I'm sure there is something I'm missing (or haven't noticed), but I don't know what the key points are. Where is the setting that allows the character to move behind only the backrest of the chair? I do not understand how to set up the details around 1:14 of the video.

The collision detection in the latter part of the video is not what I’m trying to understand this time. What I want to know is how to allow the character to move behind the chair, as shown in the image below, while appearing to sit on the chair.

Below is what it looks like after setup is complete(Godot running). Around: 2:33, 2:34

enter image description here

enter image description here


My current understanding of the video:

  • Y Sort Order for the entire chair: 1
  • Y Sort Order for the character: Unknown
  • Y Sort Order for the floor: Unknown

Based on my own guess, it should be as follows, but the video does not match this, which is puzzling:

  • Y Sort Order for the upper part of the chair: 3
  • Y Sort Order for the lower part of the chair: 1
  • Y Sort Order for the character: 2
  • Y Sort Order for the floor: 0
\$\endgroup\$
4
  • \$\begingroup\$ Where do you see the character moving behind only part of the chair? I see only the character drawing in front of the entire chair when they're lower on the screen, and behind the entire chair when they're higher on the screen. I don't see any single frame where they're drawn in front of part of the chair and behind another part of the chair simultaneously, so everything in the video can be accomplished just by sorting which whole sprite draws overtop of which other whole sprite. Maybe you're asking about the collision they add around 2:50 to stop the player from walking through the chair? \$\endgroup\$
    – LudoProf
    Commented Aug 26 at 13:57
  • \$\begingroup\$ @LudoProf I’ve included an images and the timestamp from the video. Even before adjusting the collision settings, the character can already partially move behind the backrest. \$\endgroup\$ Commented Aug 26 at 14:03
  • \$\begingroup\$ @LudoProf Ah. Around 1:14, it seems like the Y Sort is applied to the entire chair. Even though it looks like the setting is applied to the entire chair, I find it strange that the character can only move behind a part of it. \$\endgroup\$ Commented Aug 26 at 14:08
  • \$\begingroup\$ @LudoProf I've also added my current understanding. \$\endgroup\$ Commented Aug 26 at 14:31

1 Answer 1

1
\$\begingroup\$

It's not Y Sort Order, it's Y Sort Origin. Normally the Y Sort Origin is in the center of the sprite. This is indicated by the little plus in the middle of the sprite. When you change the origin value it moves up and down.

Sprites whose Y position is above this point get sorted behind, and below getting sorted in front.

I think you are confusing this with Z Index, which orders based on this index.

\$\endgroup\$
2
  • \$\begingroup\$ up voted: Upon rechecking, it was actually the Y Sort Origin. I got confused because at (1:34) the "Y Sort Enable" was turned on in the Ordering section of the right-side menu. I definitely mixed it up with the Z-index. Since it's different from the Z-index, what does setting it to 1 here mean? Does it shift the Y position by 1 pixel? If so, 1 pixel seems too small, so what does the value of 1 actually represent in this context? \$\endgroup\$ Commented Aug 27 at 2:00
  • \$\begingroup\$ Yes a shift down by one pixel. You can see the position of the center change slightly in the video at about 1:24. A bigger value would produce a more obvious effect and would probably have been better for demonstration purposes. \$\endgroup\$
    – Paul
    Commented Aug 27 at 2:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .