World-space UI
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Rendering UI elements in terms of worldspace coordinates is extremely common and is critical for things like life bars, nameplates, tooltips or interactable widgets.
However, it's not immediately obvious how to do so, and the existing workaround requires users to write their own boilerplate synchronization system.
## What solution would you like?
1. Use a dedicated `ScreenSpaceTransform` and `GlobalScreenSpaceTransform` for UI entities by default (see discussion in #4213).
2. If a UI entity also has a `GlobalTransform`, set its `ScreenSpaceTransform` to compensate, based on the UI camera's projection.
3. Add an example demonstrating a simple but realistic use case of world-space UI elements.
4. Add a test to ensure that UI elements can be children of non-UI elements in this way, and that this behaves as expected.
## What alternative(s) have you considered?
1. Create UI widgets and forcibly set their screen-space `Transform` coordinates using `WorldToScreen`.
2. Use sprites instead of actual UI elements. This is semantically incorrect, and is missing things like layout, interactivity and so on.
Contributor guide
Research direction
Start with the discussion in #4213 and review the existing WorldToScreen workaround described in the issue. Identify the UI transform and camera behavior that must support GlobalTransform parents, then verify the result with a realistic world-space UI example and a test covering UI children of non-UI elements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100