-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Parent scale.z affects child sprite z-index #4149
Comments
Isn't this behavior expected considering the sprite exists in 3d? Isn't what you're referring to as "z index" actually just the Z position in 3d? Or am I misunderstanding something? |
@lukors |
My opinion here is that this is a clear and compelling argument in favor of dedicated |
That would be great. |
As a newcomer who just stumbled on this and spent some time figuring it out, here's how I would have expected this to work for 2D:
This would also be consistent with the docs in transform.rs, which mention z-ordering for translation but not for scale. As it is, it really is not clear at all how translation, scale, and child entities interact when it comes to z-index calculation. (Incidentally, is there a write-up about that somewhere, without looking through the source?) I don't know how that would play with the larger implementation or 3D handling. It's just what would fit my initial, intuitive model. |
# Objective Scaling `z` by anything but `1.0` in 2d can only lead to bugs and confusion. See #4149. ## Solution Use a `Vec2` for the paddle size const, and add a scale of `1.0` later. This matches the way `BRICK_SIZE` is defined.
Bevy version
0.6.1
Operating system & version
Win 11
What you did
Spawned a parented sprite and change the parent's scale.z to something other than 1.0
What you expected to happen
Z-index of a sprite wouldn't be affected at all or the transform of the sprite would affect it as well.
What actually happened
It's affected by the parent transforms
Additional information
Repro
https://github.com/SecretPocketCat/bevy_issue_repro/blob/sprite_index_scale/src/main.rs
(the expected order from bottom would be red, green, blue)
The text was updated successfully, but these errors were encountered: