bevyengine / bevyengine/bevy

Split UI/2D Transforms from 3D

Open
#7,876 2 comments 7 reactions 0 assignees View on GitHub
A-Transform C-Feature C-Performance C-Usability X-Needs-SME
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 full 3D affine transform is a poor fit for UIs and often overkill for 2D uses. `Transform` and it's propagation system is a major bottleneck in `PostUpdate`, with a large number of potentially separable systems dependent on them.

## What solution would you like?
Split out `Transform2D` and `RectTransform` from `Transform`, explicitly for their respective use cases.

Pros

* Both can be smaller in memory than `Transform` and `GlobalTransform`.
* Math on both will be simpler (and faster)
* Would likely fix any oddities when dealing with Z-positions in both UI and 2D by strictly defining inheritance behavior of depth.
* UI and 2D propagation and dependent systems parallelize more readily with 3D systems.
* UI probably doesn't need a dedicated propagation or `GlobalTransform` equivalent, relying on the UI layouting algorithm instead.

Cons

* Higher complexity. Recreating propagation outside of `PostUpdate` is now more involved.
* Different components adds mental overhead to users.

## What alternative(s) have you considered?
Leave it as is for now.

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.