# Transform Driver

> Documentation version: 3.0
> HTML: https://docs.flarelive.manifolddynamics.com/reference/scene/transform-driver.html
> [Complete contents](https://docs.flarelive.manifolddynamics.com/contents.md) · [Agent index](https://docs.flarelive.manifolddynamics.com/llms.txt)

Flare Live **3.0** · **Scene Object** · API type `simexp.common.transform_driver`.

Transform Driver applies position and orientation commands to its **immediate parent**. Use it for scripted Camera placement or visual-object motion during Simulation. Add it as a child of the object you want to move:

```text
Group
└── Camera ← driven object
    └── Transform Driver ← send simulation input here
```

The driver's own transform fields are hidden. To follow another object's position automatically, use [Position Tracker](https://docs.flarelive.manifolddynamics.com/reference/scene/position-tracker.md).

## Properties

Configure both properties before initialization. They are saved in FLL and cannot change while Simulation is initialized.

| API path | Constructor default / enum choices | Meaning / units | Editable in Simulation |
| --- | --- | --- | --- |
| `coordinate_space` | 0; 0=World, 1=Parent | World uses absolute world coordinates. Parent expresses the pose relative to the driven object's parent, which is Group in the example above. | No |
| `rotation_format` | 0; 0=Quaternion, 1=Euler angles | Quaternion expects four orientation values in w, x, y, z order. Euler angles expects three angles in radians. The position channels are the same in both formats. | No |

For enum setters, pass the integer value or look up the label in `property_metadata(...).enum_options`; see [property conventions](https://docs.flarelive.manifolddynamics.com/reference/common/properties.md#enum-choices-and-flags).

## Simulation input/output

No outputs. Send one complete pose using the configured rotation format:

| Format | Input values | Units and convention |
| --- | --- | --- |
| Quaternion | `[x, y, z, qw, qx, qy, qz]` | Position in meters; quaternion order **w, x, y, z**, normalized automatically. |
| Euler angles | `[x, y, z, rx, ry, rz]` | Position in meters, angles in radians; rotation matrix `Rx(rx) × Ry(ry) × Rz(rz)`, matching SceneObject rotation. |

For example, `[4, 0, 2, 1, 0, 0, 0]` places the parent at `(4, 0, 2)` with identity orientation in the selected coordinate space. Scale stays unchanged.

Send pose inputs through [Workspace RPC](https://docs.flarelive.manifolddynamics.com/manual/operation/rpc.md) using `exchange_simulation_io`. Configure **Custom Input** to target the driver when you want a fixed pose without an external controller.

## Example: move a Camera with RPC

Follow [Workspace RPC](https://docs.flarelive.manifolddynamics.com/manual/operation/rpc.md) and start an empty headless instance or select a valid scene with Simulation stopped. Save this as `drive_camera.py`. It creates a temporary Camera, sends a pose, advances one step and prints the resulting position.

```python
from pathlib import Path
from flarelive_client import connect

output = Path("driver-output").resolve()
output.mkdir(parents=True, exist_ok=True)

with connect() as client:
    ws = client.workspace

    # Create a Camera and its pose-input component in a temporary Experiment.
    ws.begin_experiment()
    ws.set_property(ws.world_handle(), "working_directory", str(output))
    camera = ws.create_object("simexp.core.camera")
    ws.set_property(camera, "name", "Driver example Camera")
    driver = ws.create_object("simexp.common.transform_driver", parent=camera)
    ws.set_property(driver, "name", "Pose input")
    ws.initialize_simulation()

    # Initialization switches worlds, so resolve the handles again.
    camera = ws.find_scene_object("Driver example Camera")
    driver = ws.find_scene_object("Driver example Camera/Pose input")
    ws.exchange_simulation_io(
        inputs=[{"object": driver, "values": [4, 0, 2, 1, 0, 0, 0]}],
        steps=1,
    )
    print("Commanded position:", ws.get_world_transform(camera).position)
    ws.reset_simulation()
    print("Reset position:", ws.get_world_transform(camera).position)
    ws.clear_simulation()
    ws.end_experiment()
```

Run in the activated Python environment:

```sh
python drive_camera.py
```

The commanded position prints `[4.0, 0.0, 2.0]`; Reset restores the Camera's initial pose. On successful completion the example returns to the original Document.

## Holding commands and restarting

- Before the first valid input, the parent's configured pose is preserved.
- A valid input applies immediately, including while automatic advancement is paused. The last valid pose is held and reapplied each step.
- In World space, the commanded world pose stays fixed when ancestors move. In Parent space, it follows the reference parent's motion.
- Reset clears the command and restores the initial local pose. Clear also releases the driver and restores that pose.
- Use one enabled transform driver per target. Conflicting drivers, including a Position Tracker on the same parent, cause initialization to report an error.

Workspace rejects an input with the wrong number of values. The component ignores nonfinite values and zero quaternions, keeps the last valid command and logs a warning.

## Physical motion and static terrain

An enabled driver makes its target and transform-dependent descendants dynamic for Gen 2 boundary classification, even before the first command. Keep fixed terrain free of enabled transform drivers so it can use static boundary caching.

Transform Driver sets a pose through the object's existing transform interface. It does not derive velocity or introduce a kinematic rigid-body controller. For force/torque-driven physical motion, use joint drives or external-force actuators.

Direct runtime placement of rigid bodies currently supports top-level Free Joint-Body Pair / Root Body and clears their velocity. Other joint types retain their transform restrictions. Moving a Shape does not update its already-initialized rigid-body collider offset. Use this component for Camera/visual placement within those limits.
