Parent-Child Hierarchy
Implemented
This feature is fully implemented.
Entity relationships (sword attached to hand, wheel on car) via Hierarchy and WorldTransform components, with automatic transform inheritance and cascade despawn.
Hierarchy Component
WorldTransform Component
Stores the computed world-space matrix for entities in a hierarchy. Managed automatically by HierarchyTransformSystem.
HierarchyTransformSystem
Runs each frame to compute world transforms:
- For entities with a
Hierarchycomponent pointing to a valid parent, it walks the parent chain and multipliesparent.WorldTransform * child.LocalTransform - A
WorldTransformcomponent is automatically added to child entities if not present - Root entities keep their local transform as-is
Cascade Despawn
When a parent entity is despawned, all children (entities whose Hierarchy.Parent points to it) are recursively despawned as well, including native renderer cleanup.
RenderSyncSystem Integration
RenderSyncSystem automatically uses WorldTransform.Matrix if available, falling back to Transform.ToMatrix() for root entities without hierarchy.