0 votes

why Ysort wont work in godot3? it wont work even in disable or enable, have any idea how to fix this problem?

my node layout. did i do something wrong?
https://imgur.com/4Oyoxp9
-node
- tilemap
- Ysort
- KinematicBody2D(player)
- KinematicBody2D(mob)
- KinematicBody2D(tree)

asked Aug 9 in Projects by potatobanana (39 points)
edited Aug 9 by potatobanana

1 Answer

+1 vote
Best answer

If you want to use the Y-Sort option from TileMap, Node layout should look like this:

-node
    -kinematicbody2d
    -kinematicbody2d

and you set Ysort in Inspector of TileMap to on.

The way you have it now, you are sorting the player with the mob and the tree, but not with the TileMap, so caracters clip over walls

Further information here:
http://docs.godotengine.org/en/3.0/classes/class_tilemap.html?highlight=cell_y_sort#member-variables

answered Aug 9 by nooberdev (106 points)
selected Aug 10 by potatobanana

so Ysort wont work Between player , mob and the tree? my Ysort and tilemap under node. i did't clip tilemap with Ysort.
https://imgur.com/4Oyoxp9

I only get a 404 on your link.
If they are children of the TileMap, Y-sort applies to them. It applies even on Sprites from your TileMap and sorts the walls/floor with the other kinematicbodies.

https://imgur.com/a/9Ny3Fd3

this new link.
https://imgur.com/4Oyoxp9
and i still dont understand why wont work. did this Ysort need to recall in func or something? as you can see i didt tie tilemap with Ysort because i want to test 3 kinematicbody2d first. but didt work between them. my player always on top of them. i check all my z_index = 0.

do the other bodies appear to be sorted correctly? is the "z as relative" option from the kinematicbodies on? you find it right below the z-index.

yeah, and all z as relative on. i even try on and off z as relative.

omg, today i redownload godot and load save file, still did't work. then i make new project and copy paste all from previous work, and you know what it work like magic...... so this bug or what?

If you copy pasted everything, then this sounds like a bug to me. Very strange that it did not work before. I am happy it works now. :) If this happens again, I suggest you make a submission to the bug-tracker.

thanks i hope never happen again, you have discord?

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 How to use this Q&A? before posting your first questions.