LUIDA Docs

SetRotation

These pages are not yet fully reviewed. The LUIDA team is continuing to review and improve them. If you find anything wrong on these pages, or have questions that aren't resolved by reading them, please ask or report to the LUIDA team.

SetRotation(x, y, z)StableItem Manipulation
Fires
On State Start · During State · On State Exit

Description

Sets the item's world rotation using Euler degrees. Requires the MovableItem component on this item.

Parameters

NameTypeDescription
xnumberPitch around the world X axis, in degrees.
ynumberYaw around the world Y axis, in degrees.
znumberRoll around the world Z axis, in degrees.

Side effects

  • Calls the CCK MovableItem API to set this item's world transform rotation, converting Euler degrees to the underlying quaternion.
  • Requires the item to have a MovableItem component. Without it, the runtime logs a warning and the call is a no-op.
  • No state keys are written, no signals fired, and $.groupState is untouched.
  • Order of rotation axes follows Unity's standard Z-X-Y convention. If you care about exact orientation, set rotation once with a known triple rather than chaining multiple SetRotation calls.

Example

Rotate a stimulus card to face the participant differently per condition. In a hypothetical orientation study, a within-subjects angle variable picks one of three yaws:

// On State Start, gated by angle === "left"
SetRotation(0, -30, 0);

// On State Start, gated by angle === "center"
SetRotation(0, 0, 0);

// On State Start, gated by angle === "right"
SetRotation(0, 30, 0);

Same pattern as SetPosition: one SetRotation per condition branch, gated in the editor's if column.

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md

Original markdown body
- **Description**: Sets the item's world rotation using Euler degrees. **Requires the `MovableItem` component on this item.**
- **Parameters**:
  - `x`: `number`
  - `y`: `number`
  - `z`: `number`