Skip to content
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

Split UI/2D Transforms from 3D #7876

Open
james7132 opened this issue Mar 2, 2023 · 2 comments
Open

Split UI/2D Transforms from 3D #7876

james7132 opened this issue Mar 2, 2023 · 2 comments
Labels
A-Hierarchy Parent-child entity hierarchies A-Transform Translations, rotations and scales C-Enhancement A new feature C-Performance A change motivated by improving speed, memory usage or compile times C-Usability A simple quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR

Comments

@james7132
Copy link
Member

james7132 commented Mar 2, 2023

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.

@james7132 james7132 added C-Enhancement A new feature C-Performance A change motivated by improving speed, memory usage or compile times C-Usability A simple quality-of-life change that makes Bevy easier to use A-Transform Translations, rotations and scales A-Hierarchy Parent-child entity hierarchies X-Controversial There is active debate or serious implications around merging this PR labels Mar 2, 2023
@mockersf
Copy link
Member

mockersf commented Mar 3, 2023

related to #1275

@irate-devil
Copy link
Contributor

irate-devil commented Mar 13, 2023

UI probably doesn't need a dedicated propagation or GlobalTransform equivalent, relying on the UI layouting algorithm instead.

World space UI(#5476) is something to keep in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Hierarchy Parent-child entity hierarchies A-Transform Translations, rotations and scales C-Enhancement A new feature C-Performance A change motivated by improving speed, memory usage or compile times C-Usability A simple quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

No branches or pull requests

3 participants