export { ChildOf } from './children'; /** * Hierarchy back-reference: pointer from child entity to its parent. * * Store the parent `Entity` handle (returned by `world.spawn(...).unwrap()`) * in the `parent` field; `propagateTransforms` follows the ECS-maintained * `Children` list each frame to compose the child's derived * `GlobalTransform.world` mat4 (child.world = parent.world x child local). * `Transform` declares `GlobalTransform` as a * generic ECS requirement, so normal spawn/add/command paths materialize the * pair without scene-specific repair. Propagation still fails closed when an * owner explicitly removes one half. Despawning a child auto-detaches it from * its parent's Children list; despawning the parent follows ChildOf's * linkedSpawn cascade, while a malformed internal fixture can still leave a * stale source for Scene diagnostics. * * Because ChildOf declares a `relationship` mirror and a structural * `Transform` requirement, the engine keeps the parent's `Children.entities` * reverse list consistent automatically and materializes the local/world pair * when the child did not author one: adding ChildOf appends the child to the * parent's Children, removing it (or reparenting via the `exclusive` arm) * prunes the stale entry. AI users no longer hand-maintain both sides (the * prior OOS-10 contract is retired). * Reparenting is a plain re-add: `world.addComponent(child, { component: * ChildOf, data: { parent: newParent } })` on an entity that already carries * ChildOf auto-reparents (exclusive arm). The generic convenience method has * the same owner path and requires the relationship component plus its data: * `world.reparent(child, newParent, ChildOf, { parent: newParent })`. * * @example Spawn a child entity referencing an already-spawned root: * const root = world.spawn( * { component: Transform, data: {...} }, * ).unwrap(); * const child = world.spawn( * { component: Transform, data: {...} }, * { component: ChildOf, data: { parent: root } }, * ).unwrap(); * // root now carries Children with [child] in its `entities` list. */ //# sourceMappingURL=child-of.d.ts.map