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
| Parameter | Type | Required | Description |
|---|---|---|---|
| Object | string | Yes | The object whose parent you want to change. |
| New Parent Object | string | Yes | The new parent object in the scene hierarchy. The object will become a child of this parent. |
| Maintain World Position | boolean | No | If 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 Positionparameter 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.Learner clicks “pick up wrench” button, triggering a transition:
- Transform Object: (animate the wrench to the hand position)
- Target Position: (hand coordinates)
- Duration:
500ms
- Set Parent:
- Object:
wrench - New Parent Object:
hand - Maintain World Position:
true(keep wrench visually where it is after animation)
- Object:
- Set Variable:
hasWrench = true
Assembly Part Attachment
Scenario: A training shows parts being attached to an assembly. Each part should stick to the assembly and move with it.Transition triggered by clicking “Attach Component”:
- Transform Object: Animate
component_ato position on the assembly.- Target Position: (1, 0.5, 0) relative to assembly
- Duration:
1500ms
- Set Parent:
- Object:
component_a - New Parent Object:
assembly_base - Maintain World Position:
true
- Object:
Multiple Parts to a Group
Scenario: A training shows grouping multiple components together under a parent object (a container or assembly frame).State
Grouping:- Objects exist:
component_a,component_b,component_c, and an empty parent objectgroup_container.
Transition triggered by clicking “Group Items”:
- Set Parent: Object:
component_a, New Parent:group_container, Maintain World Position:true - Set Parent: Object:
component_b, New Parent:group_container, Maintain World Position:true - Set Parent: Object:
component_c, New Parent:group_container, Maintain World Position:true
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.Transition triggered by “Drop Wrench” button:
- Set Parent:
- Object:
wrench - New Parent Object:
rootornull(no parent — makes it top-level in hierarchy) - Maintain World Position:
true(wrench stays where it was visually)
- Object:
- Play Audio:
wrench_drop_sound.mp3 - Set Variable:
hasWrench = false
Dynamic Positioning with Maintain World Position
Scenario: Understanding the difference betweenMaintain World Position: true and false.
Object
tool is at world position (5, 2, 0).- Current parent:
table(at world position 0, 0, 0).
workbench (at world position 10, 1, 0).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.)
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.

