Skip to content

Split UI/2D Transforms from 3D #7876

@james7132

Description

@james7132

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-TransformTranslations, rotations and scalesC-FeatureA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useX-Needs-SMEThis type of work requires an SME to approve it.

    Type

    No type

    Projects

    Status

    Widget-ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions