Open-Source Wikis

/

Bevy

/

Packages

/

bevy_transform

bevyengine/bevy

bevy_transform

Hierarchy-aware transforms. Transform (local), GlobalTransform (world), and the propagation system that keeps them in sync.

Purpose

Practically every entity that lives in space has a Transform. Cameras, meshes, sprites, lights, UI nodes, particles. bevy_transform provides:

  • Transform — local translation, rotation, scale.
  • GlobalTransform — world-space transform, computed from the chain of parents.
  • TransformPlugin — propagation systems that run in PostUpdate.
  • TransformBundle — convenience bundle (Transform + GlobalTransform).

Directory layout

crates/bevy_transform/src/
├── lib.rs
├── components/
│   ├── transform.rs         # Transform component
│   └── global_transform.rs  # GlobalTransform component
├── systems.rs               # Propagation systems
├── plugins.rs
├── helper.rs                # TransformHelper system param
└── traits.rs

Key abstractions

Type File Description
Transform crates/bevy_transform/src/components/transform.rs Local translation/rotation/scale.
GlobalTransform crates/bevy_transform/src/components/global_transform.rs World-space transform (matrix).
TransformPlugin crates/bevy_transform/src/plugins.rs Adds the propagation systems.
TransformBundle crates/bevy_transform/src/bundles.rs (Transform, GlobalTransform).
TransformHelper crates/bevy_transform/src/helper.rs System param for "compute global transform on demand."

How it works

Two propagation systems run in PostUpdate:

  1. Sync change ticks so newly-changed Transforms mark their subtree dirty.
  2. Walk the hierarchy in parallel using disjoint subtrees, multiplying parent GlobalTransform by child Transform to produce child GlobalTransform.

The implementation in systems.rs uses unsafe code (with a careful invariant check on subtree disjointness) to parallelize across roots while keeping the borrow checker happy.

Integration points

  • Depends on: bevy_app, bevy_ecs, bevy_math, bevy_reflect.
  • Depended on by: Almost every spatial subsystem — bevy_pbr, bevy_sprite, bevy_ui, bevy_camera, bevy_animation, bevy_audio (spatial), …

Entry points for modification

  • Performance: systems.rs. Hierarchy walks are perf-sensitive.
  • New transform component: define alongside existing types and add propagation logic.
  • Helper APIs: helper.rs for one-off "what's this entity's world transform right now?" queries.

See also

  • bevy_math — transform matrices via glam.
  • bevy_ecsChildOf/Children relationships used for hierarchy.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

bevy_transform – Bevy wiki | Factory