AddChildRotation
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.
AddChildRotation(childName, x, y, z)StableChild Manipulation- Fires
- On State Start · During State · On State Exit
Description
Adds to the local rotation of a specified child object using Euler degrees.
Parameters
| Name | Type | Description |
|---|---|---|
childName | string | Name of the child GameObject under this item to rotate. Case-sensitive. |
x | number | Pitch offset around the local X axis, in degrees. |
y | number | Yaw offset around the local Y axis, in degrees. |
z | number | Roll offset around the local Z axis, in degrees. |
Side effects
- Reads the child sub-node's current local rotation via
$.subNode(childName), composes the supplied Euler offset on top, and writes the resulting rotation back. - Does not require
MovableItemon the parent. - If the named child doesn't exist, the runtime logs a warning and the call is a no-op.
- No state keys are written, no signals fired, and
$.groupStateis untouched. - Repeated calls accumulate. The composition uses quaternion multiplication, so large offsets can produce non-obvious final rotations due to axis interaction — prefer
SetChildRotationwhen you want a known absolute orientation.
Example
Use On State Start / On State Exit symmetry to tilt a feedback indicator forward at the start of the trial and back at the end, leaving the parent item untouched:
// On State Start
AddChildRotation("Indicator", 15, 0, 0);
// On State Exit
AddChildRotation("Indicator", -15, 0, 0);Because both offsets are equal and opposite, the indicator returns to its rest pose between trials regardless of how many times the state fires.
Related
SetChildRotation(childName, x, y, z)— absolute local rotation; less prone to drift across calls.AddChildPosition(childName, x, y, z)— the position counterpart.AddRotation(x, y, z)— when you want to rotate the whole item instead of a sub-node.- Concepts → State machine lifecycle — symmetrical
On State Start/On State Exitpatterns.
Source
Assets/Doc/LUIDA-StateListeningItemScriptDoc.md
Original markdown body
- **Description**: Adds to the local rotation of a specified child object using Euler degrees.
- **Parameters**:
- `childName`: `string`
- `x`: `number`
- `y`: `number`
- `z`: `number`