AddChildPosition
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.
AddChildPosition(childName, x, y, z)StableChild Manipulation- Fires
- On State Start · During State · On State Exit
Description
Offsets the local position of a specified child object.
Parameters
| Name | Type | Description |
|---|---|---|
childName | string | Name of the child GameObject under this item to nudge. Case-sensitive. |
x | number | Local-space X offset relative to the child's current position, in meters. |
y | number | Local-space Y offset relative to the child's current position, in meters. |
z | number | Local-space Z offset relative to the child's current position, in meters. |
Side effects
- Reads the child sub-node's current local position via
$.subNode(childName), adds the supplied offset, and writes it back. - Does not require
MovableItemon the parent — operates through CCK's sub-node transform API, which is independent of the movable-item permission system. - 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. For symmetric "nudge in, nudge out" patterns across state entry/exit, pair an
On State StartAddChildPositionwith an equal-and-oppositeOn State ExitAddChildPosition.
Example
Animate an indicator pip outward from its origin during the response window, then snap it back when the state exits:
// On State Start (cue appears, pip slides 10cm forward)
AddChildPosition("Pip", 0, 0, 0.1);
// On State Exit (pip returns to neutral)
AddChildPosition("Pip", 0, 0, -0.1);For step-change placement (e.g., per-trial positioning gated by CONDITION), prefer SetChildPosition so the final pose doesn't depend on prior offsets.
Related
SetChildPosition(childName, x, y, z)— absolute local position; usually preferred for per-trial setups.AddChildRotation(childName, x, y, z)— the rotation counterpart on the same sub-node.AddPosition(x, y, z)— when you want to nudge the whole item instead of a sub-node.- Concepts → State machine lifecycle —
On State Start/On State Exitsymmetry patterns.
Source
Assets/Doc/LUIDA-StateListeningItemScriptDoc.md
Original markdown body
- **Description**: Offsets the local position of a specified child object.
- **Parameters**:
- `childName`: `string`
- `x`: `number`
- `y`: `number`
- `z`: `number`