bevyengine / bevyengine/bevy

Anchor Ui Nodes to In-World Entities

Open
#19,832 5 comments 3 reactions 0 assignees View on GitHub
A-Transform A-UI C-Feature S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

A common use case is to have Ui Nodes ( over character names, healthbar or status effects ) with interactivity such as clicking on, hovering, located above or on a character or object in the World.

## What solution would you like?

There are multiple ways to solve this:

- A way to tell a UI node that it should follow the onscreen location off another entity
- Relations is a good way for this
- Putting the UI node in a hierarchy that is not only Ui Nodes
- This adds some complexity, since position might not be the only aspect of the UiNode one wants to change depending on the values of the target entity. Mostly since this would be hiearchies that crosses domains

## What alternative(s) have you considered?

Keeping this in a separate crate, such as [bevy_ui_anchor](https://github.com/TotalKrill/bevy_ui_anchor)

## Additional context

There are more aspects than just syncing the positions to the inworld entity, you would also probably want to have easy access to the target entity for various reasons.

- Should the UiNodes follow the visibility of the target entity
- Should the UiNodes follow the scaling of the target entity ( in many cases this is not wanted, but a custom scaling would work better, for example a minimum/maximum UiNode size )
- The Ui Nodes should maybe be visible, since they can be partly on screen, even though the target in-world entity is entirely offscreen.
- How should this relate to multi-camera setups?
- Offsets to the Ui Node (keeping it above a character, not on the characters feet)
- Could be done by hierarchies
- Could be done by offset values in componet as in bevy_ui_anchor

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.