LUIDA Docs

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

NameTypeDescription
childNamestringName of the child GameObject under this item to nudge. Case-sensitive.
xnumberLocal-space X offset relative to the child's current position, in meters.
ynumberLocal-space Y offset relative to the child's current position, in meters.
znumberLocal-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 MovableItem on 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 $.groupState is untouched.
  • Repeated calls accumulate. For symmetric "nudge in, nudge out" patterns across state entry/exit, pair an On State Start AddChildPosition with an equal-and-opposite On State Exit AddChildPosition.

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.

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`