Verse Library verse

01 Fragment

Traverses the entity tree to access parents, children, and root simulation objects.

verse-library/verse-scene-graph-hierarchy-transforms/01-fragment.verse

# Get this entity's parent. Square brackets [] because it can fail
# (the root has no parent), so we guard it with if:
if (Parent := SomeEntity.GetParent[]):
    # ...we have a parent, do something with it

# Get the direct children of this entity (one level down).
Children := SomeEntity.GetEntities()

# Get the rootmost entity of the whole experience.
if (Root := SomeEntity.GetSimulationEntity[]):
    # Root is the simulation entity

Comments

    Sign in to vote, comment, or suggest an edit. Sign in