LUIDA Docs

SetChildRotation

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.

SetChildRotation(childName, x, y, z)StableChild Manipulation
Fires
On State Start · During State · On State Exit

Description

Sets the local rotation of a specified child object using Euler degrees.

Parameters

NameTypeDescription
childNamestringName of the child GameObject under this item to rotate. Case-sensitive.
xnumberPitch around the local X axis, in degrees.
ynumberYaw around the local Y axis, in degrees.
znumberRoll around the local Z axis, in degrees.

Side effects

  • Calls $.subNode(childName).setRotation(...) — sets the child's local-space rotation via CCK's sub-node API.
  • Does not require MovableItem on the parent.
  • If the named child doesn't exist or doesn't expose setRotation, the runtime logs a warning and the call is a no-op.
  • No state keys are written, no signals fired, and $.groupState is untouched. The change is networked to all players.
  • Order of rotation axes follows Unity's standard Z-X-Y Euler convention.

Example

Reorient a stimulus's Card sub-node to one of three discrete yaws based on a per-trial angle condition, while leaving the parent item's transform untouched (e.g., because the parent is anchored to a fixed mount):

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

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

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

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md

Original markdown body
- **Description**: Sets the local rotation of a specified child object using Euler degrees.
- **Parameters**:
  - `childName`: `string`
  - `x`: `number`
  - `y`: `number`
  - `z`: `number`