+1 vote

I want to control how high or low my sprites would go, before hiding behind or appearing in front of other sprites (y-sort). Upon observation, I think that this is controlled by the "tile origin", because altering this changes the way that y-sort works.

Is there any way to do this? Thanks!

in Engine by (18 points)

I have this problem, too.

1 Answer

0 votes

Actually I found the solution in which the official demo has shown.
1.You simply set the offset of each tile object (a sprite) to proper position.
(I suggest set to its central point of the ground plane)
2.And then set tile-origin to "center" in your tilemap node. So that your tile brush
will align to the tile.

The tile position isn't changed though, but we "offset" the sprite already.
So the sprite will be render at the upper-left of its tile position.
As a result, the "y-value" in y-sort of that tile is visually correct.


This is a side wall from my work (in case you can't tell...)

So we need to set the offset of the sprite to (-35, -345), which makes the new origin
to (35, 345).
Notice that Godot also set a new pivot after you change offset.
Here is my quick demo:
Fix render order

by (44 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.