Skip to main content

Module hierarchy

Module hierarchy 

Source
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 ancestor occurs strictly above of. 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 None for 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 false without mutation for dead handles, cycles, non-finite matrices or a singular parent. Shear introduced by a rotated non-uniformly scaled parent is rejected because Transform cannot represent it exactly.
set_parent_local
Reparents without changing the local transform. Accepts zero-scale parents. Returns false without 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.teleport request set before the next physics step; crate::script::Ctx::teleport_of handles this for scripts.
spawn_named
Spawns an entity with Name and identity Transform. Built-in component storages must already be registered by the host.
update_globals
Refreshes GlobalTransform for every entity that has a Transform. 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.