Expand description
Parent/child relations and world-space transforms.
set_parent preserves the world pose; set_parent_local preserves the
local transform. Both reject dead handles, cycles and invalid parent chains.
Matrices use column vectors, +Y up and local -Z forward. Transform rotations
are stored as Euler degrees. Directly inserting Parent bypasses validation;
traversal still terminates on malformed cycles.
Functionsยง
- ancestors_
count - Number of distinct living ancestors, excluding the entity itself.
- children
- Children in index order, without transient system-made entities.
- children_
all - Children in index order, including transient ones created by systems.
- descendants
- All descendants, including transient entities, each returned once. Children are visited deterministically; the root is excluded even on cycles. The parent map is built once, avoiding a world scan per visited node.
- despawn_
recursive - Destroys a subtree, including transient system entities. Stale roots are ignored.
- find_
all_ by_ name - Returns every exact name match in entity index order.
- find_
by_ name - First exact name match in component storage order. Names need not be unique.
- find_
descendant - Finds a named entity inside a subtree, optionally including the root.
- global_
matrix - Computes the current world matrix directly from local transforms. Missing transforms contribute identity; stale handles return identity. Malformed cycles are truncated before revisiting an entity.
- is_
ancestor - Whether
ancestoroccurs strictly aboveof. Traversal is cycle-safe. - is_
visible - Effective mesh visibility inherited through the living parent chain. Missing visibility components default to visible; stale entities return false. Cycles are visited once, so directly inserted malformed links cannot hang rendering.
- name_of
- Entity name, or an empty string for stale or unnamed entities.
- parent_
of - Living parent, or
Nonefor roots and dangling links. - roots
- Non-transient entities without a living parent, in index order.
- set_
parent - Reparents while keeping the world pose when it is representable as TRS.
Returns
falsewithout mutation for dead handles, cycles, non-finite matrices or a singular parent. Shear introduced by a rotated non-uniformly scaled parent is rejected becauseTransformcannot represent it exactly. - set_
parent_ local - Reparents without changing the local transform. Accepts zero-scale parents.
Returns
falsewithout mutation for stale handles or invalid/cyclic chains. - set_
world_ position - Changes only local translation to place an entity at a world-space point.
Rejects stale/missing transforms and singular/non-finite parent matrices.
Dynamic bodies also need their
RigidBody.teleportrequest set before the next physics step;crate::script::Ctx::teleport_ofhandles this for scripts. - spawn_
named - Spawns an entity with
Nameand identityTransform. Built-in component storages must already be registered by the host. - update_
globals - Refreshes
GlobalTransformfor every entity that has aTransform. Healthy parent chains are resolved once and cached for this call, making a complete refresh linear in the entity count even for a long chain. Directly inserted cyclic links fall back to bounded per-entity evaluation.