> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altoura.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transform Object

> Move, rotate, or scale 3D objects over time

## Overview

The **Transform Object** action changes an object's position, rotation, or scale. You can apply transformations instantly (snap) or animate them smoothly over a specified duration. This is how you create dynamic movement within your training—sliding drawers, rotating valves, scaling up objects, and more.

## Parameters

| Parameter       | Type               | Required | Description                                                                                                                                         |
| --------------- | ------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Object          | string             | Yes      | Select the 3D object to transform from the scene hierarchy.                                                                                         |
| Target Position | X, Y, Z            | No       | The new position in 3D space (in meters). Leave blank if you don't want to move the object.                                                         |
| Target Rotation | X, Y, Z            | No       | The new rotation in degrees (X = pitch, Y = yaw, Z = roll). Leave blank to skip rotation changes.                                                   |
| Target Scale    | X, Y, Z            | No       | The new size scale. (1, 1, 1) is the object's native size; (2, 2, 2) is double size. Leave blank to skip scaling.                                   |
| Transform Mode  | enum               | Yes      | How to apply the transform: `snap` (instant) or `linearInterpolation` (animate over duration).                                                      |
| Duration        | number             | No       | For animated transforms (linearInterpolation), the duration in milliseconds. Default is 1000 (1 second). Ignored if mode is `snap`.                 |
| Spline Path     | array of waypoints | No       | (Advanced) Move the object along a curved path through multiple waypoints instead of direct linear movement. Each waypoint is a position (X, Y, Z). |

## Key Behavior

* **Snap mode**: The transform completes instantly. The object jumps to the new position/rotation/scale.
* **LinearInterpolation mode**: The transform animates smoothly from the current state to the target state over the specified duration.
* **Simultaneous changes**: You can move, rotate, and scale an object in a single action.
* **Non-blocking**: The action doesn't wait for the animation to complete. Other actions run immediately unless you add a Delay.
* **Spline paths**: For curved movement (e.g., a ball rolling around a track), use waypoints instead of a direct position.

## Practical Examples

### Sliding Drawer Animation

**Scenario**: A maintenance training shows a technician opening a panel drawer. The drawer slides out smoothly over 2 seconds.

<Steps>
  <Step>
    State `InspectPanel` `onEntry`:

    1. **Load Scene**: `maintenance_room`
    2. **Play Audio**: "Slide the access panel drawer to the right"
  </Step>

  <Step>
    Learner clicks "Open Drawer" button, triggering transition:

    1. **Transform Object**:
       * Object: `panel_drawer`
       * Target Position: (2, 0, 0) — move 2 meters to the right
       * Transform Mode: `linearInterpolation`
       * Duration: `2000` (2 seconds)
    2. **Delay**: `2000` (wait for animation)
    3. **Play Audio**: "The panel is now open. Inspect the components."
  </Step>

  <Step>
    The drawer smoothly slides open, then narration guides the learner to inspect.
  </Step>
</Steps>

### Instant Scale Change

**Scenario**: An object needs to change size instantly (e.g., a tool expands to full size when selected).

<Steps>
  <Step>
    Transition triggered by clicking a tool:

    * **Transform Object**:
      * Object: `magnifying_glass`
      * Target Scale: (3, 3, 3) — scale up to 3× size
      * Transform Mode: `snap` (instant)
  </Step>

  <Step>
    The tool instantly becomes larger, making details visible.
  </Step>
</Steps>

### Rotating Valve Animation

**Scenario**: A valve must rotate 90 degrees to open. The rotation should animate over 1 second.

<Steps>
  <Step>
    Learner clicks the valve, triggering transition:

    1. **Transform Object**:
       * Object: `control_valve`
       * Target Rotation: (0, 90, 0) — rotate 90 degrees around Y axis
       * Transform Mode: `linearInterpolation`
       * Duration: `1000`
    2. **Delay**: `1000` (wait for rotation)
    3. **Set Variable**: `valveOpen = true`
  </Step>

  <Step>
    The valve rotates smoothly, then a variable is set to record the action.
  </Step>
</Steps>

### Curved Path Movement

**Scenario**: An object must follow a curved path (e.g., a ball rolling around a track or a tool moving along an assembly line).

<Steps>
  <Step>
    Use Spline Path with waypoints:

    * **Transform Object**:
      * Object: `assembly_part`
      * Spline Path: `[(0, 0, 0), (1, 2, 0), (2, 2, 1), (3, 0, 1)]` (4 waypoints forming a curve)
      * Transform Mode: `linearInterpolation`
      * Duration: `4000` (4 seconds for the entire path)
  </Step>

  <Step>
    The object smoothly follows the curved path from waypoint to waypoint.
  </Step>
</Steps>

### Complex Multi-Transform

**Scenario**: An object needs to move, rotate, and scale simultaneously (e.g., a component being installed, twisted, and fitted into place).

<Steps>
  <Step>
    Transition triggered by learner action:

    * **Transform Object**:
      * Object: `gasket_component`
      * Target Position: (1, 0.5, 0) — move into position
      * Target Rotation: (45, 0, 0) — twist 45 degrees
      * Target Scale: (0.8, 0.8, 0.8) — compress slightly for fitting
      * Transform Mode: `linearInterpolation`
      * Duration: `2500` (2.5 seconds)
  </Step>

  <Step>
    All three transformations animate in parallel, creating a realistic installation motion.
  </Step>
</Steps>

### Undo/Reset Motion

**Scenario**: An object animates to a position. If the learner chooses "undo," animate it back to the original position.

<Steps>
  <Step>
    Original position of `lever` is (0, 0, 0).
  </Step>

  <Step>
    Action: Learner pulls lever → animate to (1, 0, 0) over 1 second.
  </Step>

  <Step>
    If learner clicks "undo":

    * **Transform Object**:
      * Object: `lever`
      * Target Position: (0, 0, 0) — back to start
      * Transform Mode: `linearInterpolation`
      * Duration: `1000`
  </Step>

  <Step>
    The lever animates back to its original position.
  </Step>
</Steps>

<Tip>
  For smooth animations, use `linearInterpolation` with durations of 1–3 seconds. Faster (\< 500ms) can feel jarring; slower (> 5s) can feel sluggish.
</Tip>

<Note>
  Transform animations are purely visual. If an object has physics or collision, these are not updated during animation in real-time—the collision will snap to the final position when the animation completes.
</Note>

<Warning>
  If you transform a parent object while it has child objects, the children move and rotate with it. Be careful with parent-child hierarchies during complex animations.
</Warning>
