[SOLVED] YSort issue. Moving behind and in front of the props

Searching for solution with this example:
is
Person walk behind the house correctly. And in front of the house there is some issue.
I’m using YSort behavior.

Hi, here is a possible solution given by jumpingj at the end of this thread: YSort Extention

1 Like

Hello artyom.khnat and welcome. The ysort extension works best if you manually position the origin point of your objects. So open each object and in the properties tab, select edit points. Move the red origin point to the base of the sprite. Maybe all the way to the bottom or just a little bit up. It depends on what you’re aiming for.

If you have a separate (hidden) object to act as a blocker obstacle at the base of the house using the collision condition then this may affect your origin point position. The size of the blocker will be affected by how ‘thick’ you want the object to be. A house would have a bigger blocked area than the front fence.

I’m running a preview with hit boxes and points showing. The origin points are the ones in red where it says ‘position’.

image

1 Like

Thanks a lot for the answer!
But that didnt worked for me…


I set the origin position as you said.
What else can I pay attention to?

Does both the person and the house have the ysort behavior? Or have you only given it to the house?

1 Like

You are my hero today! :love_letter:

1 Like

Haha, good, glad it’s working now. I like your graphics by the way. And think about what’s happening with ysort. Whatever Y position the object has will become its Z value. So if the house is at 200 Y, its Z value will be 200. And the person’s Z value will change as it moves up and down in the Y axis.

1 Like

A little bit complicated for me, but still so curios. I would show you my small game (with this graphics) if you want to. Later.

I agree with you, it is difficult to understand at first. I read so many posts here trying to understand it when I first tried to use it. And then when I finally understood it, it seemed so easy, haha. I love the ysort extension so much that I made an example of it in a recent Gdevelop examples jam. It’s an in browser example with a downloadable game file. It might help you to visualise how ysort works.

Yes, please do share your game when you’re ready.

1 Like

Wow, I’m really glad that you wrote to me. Thanks a lot again!
Your example looks very neat and soft :heart_eyes:

2 Likes

I have one more thing that I hope will be helpful to anyone in the future who wants to understand the Ysort extension better. It shows the various stages of a person walking from one house to another house. As the person goes lower on the screen their Y position value gets higher. And so their Z value will also get higher as it will be whatever the Y position value is.

2 Likes