bevy
bevy copied to clipboard
Split UI/2D Transforms from 3D
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
TransformandGlobalTransform. - 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
GlobalTransformequivalent, relying on the UI layouting algorithm instead.
Cons
- Higher complexity. Recreating propagation outside of
PostUpdateis now more involved. - Different components adds mental overhead to users.
What alternative(s) have you considered?
Leave it as is for now.
related to #1275
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.