-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to YSort sprites underneath the smoothing node on a Player with tilemap. #31
Comments
Thanks, will check it as soon as I can! 👍 |
I came back to experiment a little with it. Turns out it was as simple as disabling 'global out' on the smoothing node. 😝 I had tried it before but I guess I had something set up wrong. |
Having a little look. I'm not an expert at y-sorting, but I think the problem is that the I'm not 100% sure this is to do with smoothing actually, because the same occurs if I move the Related to https://godotengine.org/qa/65742/how-to-ysort-kinematic-body-and-tilemap ? |
I can't actually get this to work with Godot 4.0 stable even without smoothing addon. 😆 I did get it to work at one point fiddling with the project, but I have no idea why. Given that there may be some bugs in y sorting in Godot 4 I would recommend starting with a project that works without smoothing, then we can work from there. I very rarely work on Godot 4 hence I'm not super familiar with it, what are bugs etc. |
That's actually really odd. I did get it to work with the player smoothing node setup, have to turn on YSort on the Player node and disable "global out" on the smoothing node, which did it. I don't know why you're unable to get it to work with normal nodes. So I definitely know the tilemap position being 0,0 isn't it, but as you said 4.0 can be pretty buggy still, so it just seems like a bunch of janky-ness from it. Thanks for taking the time to look into it! |
Just adding a +1 to @NikkuNakku, I have Y sorting working in 4.0.1 but if I use a smoothing node all Y sorting with that CharacterBody2D (and associated sprite) breaks for me, not just tilemaps. |
I'll try and have another look, but any more minimum reproduction projects for this would be really useful. 👍 |
I've managed to reproduce it with a simpler project: When set to global in / out, it seems to break the y sorting. I'll have a look further but this could be a bug in core, possibly to do with y sort not working when Good news is it does seem to work in local mode. If you make sure the smoothing node has no transform applied (from a parent) turn off the global in / out, set the target, and it seems to work ok. EDIT: Also seems to happen in Godot 3.x. No idea why yet, will have a look at the core source code. UPDATE: I'll add this to the docs. 👍 I don't think this should affect core 2D interpolation ( godotengine/godot#76252 ) as that works internally in |
- set Y Sort Enabled on all recursive parents of all gameplay sprites (PC and obstacles) - set Z index to 5 on PC and obstacles root - clear PC Z index override in scenes This still doesn't work because of the Smoothing2D node on PC which messes up rendering due to set_as_toplevel lawnjelly/smoothing-addon#31 I couldn't fix it just by unchecking global in/out because it caused the PC to be super fast. In addition, for some reason, now even simple sprites without instantiated scenes fail to follow Y Sort Enabled.
Sorry, but unchecking global out will make my sprite go away super fast, like at 2x speed, compared to the collider. So I cannot use this trick. I'll try to open an issue but I need to make a MWE. EDIT: I started making a MWE and realized the offset was exactly the initial character position that itself offset the Smoothing node I set as child. I read the paragraph you added to the README (https://github.com/lawnjelly/smoothing-addon#y-sort-in-2d) and see that I should not parent the Smoothing node. So I'll just follow the instructions closely. EDIT 2: I confirm it works, even if you dynamically reparent Smoothing2D to an outer node at runtime. But if you do so, remember to readjust the global Z index! (or work with global Z index to start with) |
I'll leave this issue open in case others have the same problem. |
YSort is enabled properly on 'TileMap' node and 'Level' node. When dragging 'Player' node in the editor, the YSort seems to work. So it's only broken when running the game.
Minimum reproduction project: smoothingysortsetup.zip
(At least I believe that's how a minimum reproduction project works. First time doing this haha. Just everything stripped down to the bare minimum needed to showcase the issue I'm assuming.)
The text was updated successfully, but these errors were encountered: