Skip to main content

Overview

The Set Parent action changes an object’s parent in the 3D scene hierarchy at runtime. When an object has a parent, it moves, rotates, and scales together with that parent. This enables dynamic hierarchy changes—like attaching a tool to a hand, making one object follow another, or grouping objects programmatically.

When to Use

  • Attachment mechanics: attach a tool or part to a learner’s hand or avatar
  • Following behavior: make one object follow and move with another
  • Dynamic grouping: organize objects by making them children of a container
  • Relative positioning: change how an object’s position is calculated relative to its parent
  • Complex interactions: simulate picking up, placing, or installing objects

Parameters

ParameterTypeRequiredDescription
ObjectstringYesThe object whose parent you want to change.
New Parent ObjectstringYesThe new parent object in the scene hierarchy. The object will become a child of this parent.
Maintain World PositionbooleanNoIf true, the object’s visual position in the world doesn’t change (its local position is recalculated). If false, the object’s local position relative to the new parent is preserved, which may move it visually. Default is false.

Key Behavior

  • Hierarchy update: The object’s position in the scene hierarchy changes; it is now a child of the new parent.
  • Transformation inheritance: The object inherits transformations from its new parent. If the parent moves, rotates, or scales, the child moves/rotates/scales with it.
  • World position handling: The Maintain World Position parameter controls whether the object visually “jumps” when reparented.
    • true: Object stays where it was in world space; its local position is adjusted accordingly.
    • false: Object’s local position relative to the parent stays the same, which may visually move it.
  • Multiple changes: You can change an object’s parent multiple times during a training.

Practical Examples

Attaching a Tool to Hand

Scenario: A training shows a learner picking up a wrench. Once picked up, the wrench should move with the hand.
1
Initial state: wrench is on a table, not a child of anything (or a child of the table).
2
Learner clicks “pick up wrench” button, triggering a transition:
  1. Transform Object: (animate the wrench to the hand position)
    • Target Position: (hand coordinates)
    • Duration: 500 ms
  2. Set Parent:
    • Object: wrench
    • New Parent Object: hand
    • Maintain World Position: true (keep wrench visually where it is after animation)
  3. Set Variable: hasWrench = true
3
After this action, the wrench moves with the hand. If the hand moves, the wrench moves too.

Assembly Part Attachment

Scenario: A training shows parts being attached to an assembly. Each part should stick to the assembly and move with it.
1
State AssemblyLine:
  • assembly_base is the main object.
  • Learner adds component_a to the assembly.
2
Transition triggered by clicking “Attach Component”:
  1. Transform Object: Animate component_a to position on the assembly.
    • Target Position: (1, 0.5, 0) relative to assembly
    • Duration: 1500 ms
  2. Set Parent:
    • Object: component_a
    • New Parent Object: assembly_base
    • Maintain World Position: true
3
Now component_a is a child of assembly_base. If the assembly is moved or rotated later, the component moves with it.

Multiple Parts to a Group

Scenario: A training shows grouping multiple components together under a parent object (a container or assembly frame).
1
State Grouping:
  • Objects exist: component_a, component_b, component_c, and an empty parent object group_container.
2
Transition triggered by clicking “Group Items”:
  1. Set Parent: Object: component_a, New Parent: group_container, Maintain World Position: true
  2. Set Parent: Object: component_b, New Parent: group_container, Maintain World Position: true
  3. Set Parent: Object: component_c, New Parent: group_container, Maintain World Position: true
3
All three components are now children of group_container. Moving the container moves all three at once.

Reparent to Root (Detach)

Scenario: A tool is attached to a hand, but the learner drops it. The tool should detach and fall to the ground.
1
Current state: wrench is a child of hand.
2
Transition triggered by “Drop Wrench” button:
  1. Set Parent:
    • Object: wrench
    • New Parent Object: root or null (no parent — makes it top-level in hierarchy)
    • Maintain World Position: true (wrench stays where it was visually)
  2. Play Audio: wrench_drop_sound.mp3
  3. Set Variable: hasWrench = false
3
The wrench is now detached and no longer moves with the hand.

Dynamic Positioning with Maintain World Position

Scenario: Understanding the difference between Maintain World Position: true and false.
1
Object tool is at world position (5, 2, 0).
  • Current parent: table (at world position 0, 0, 0).
New parent will be workbench (at world position 10, 1, 0).
2
If Maintain World Position: true:
  • The tool stays visually at (5, 2, 0) in world space.
  • Its local position relative to workbench is calculated to keep it in the same place.
  • (Local position becomes approximately (-5, 1, 0) relative to workbench.)
3
If Maintain World Position: false:
  • The tool’s local position relative to table is applied to workbench.
  • If it was at local (5, 2, 0) on the table, it stays at local (5, 2, 0) on the workbench.
  • The tool visually jumps to a new world position.
Almost always use Maintain World Position: true unless you have a specific reason to change it. This prevents objects from visually “jumping” when you reparent them.
Reparenting an object does not change the object itself—only its relationship to other objects in the hierarchy. The object’s scale, material, or any other property remains unchanged.
Be cautious with circular hierarchies: don’t make an object a child of one of its own descendants. This creates an infinite loop and breaks the scene hierarchy. The engine will typically prevent this, but it’s good practice to avoid it in your action design.