-
-
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
Rotated text is rendered outside of its container #11241
Comments
Text scaling also broken after the commit 0483b69 |
This is easy to fix, I'm just going to sort it out now, but we need a better solution for text orientation than hacking around with the transforms. |
Text scaling shouldn't really be used anyway as the glyphs textures will still be the original size was so the result will probably look really bad. |
# Objective UI node text is drawn in the wrong position after rotation or scaling. ![294723406-d031a3e6-a4f9-48b4-a66a-ee963100a8b9](https://github.com/bevyengine/bevy/assets/27962798/2755e2e3-6a03-4ee8-8676-bdcaa72ec678) ## Solution In `extract_text_uinodes` to set the text's offset create a translation matrix and multiply it by the UI node's transform. Previously the offset was just added directly to the translation of the Node's `GlobalTransform`, which meant no scaling or rotation would be applied to the offset. <img width="961" alt="296440025-537ec11c-1ea1-469c-8eec-2ad4ae012095" src="https://github.com/bevyengine/bevy/assets/27962798/eae1a1d2-1369-47ad-8963-3862d03ec0bf"> <img width="961" alt="296440156-dd04029d-8112-4fa5-89a2-56d7acab66df" src="https://github.com/bevyengine/bevy/assets/27962798/90b1b6db-13f4-4745-9f14-7c1661baad50"> Fixes #11241
Bevy version
main, since 0483b69
This would probably be fixed in a roundabout way by #9341
Relevant system information
scale_factor
1.0
and2.0
were tested.What you did
cargo run --example pbr
What went wrong
The "metallic" text on the right side should be aligned with the edge of the right column of spheres. But it is overlapping them.
I added
background_color: Color::RED.into()
in the screenshot below.Additional information
It seems sort of like a coincidence that this worked before. I think that this https://github.com/ickshonpe/bevy/blob/99c43fabdfed9fe9fa161c2d4f3dfbdb8ea35a5b/crates/bevy_ui/src/render/mod.rs#L646 is the problem line, or close to it.
There may be other bits of rotated text in the examples that should be looked at.
The text was updated successfully, but these errors were encountered: