SetChildPosition
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.
SetChildPosition(childName, x, y, z)StableChild Manipulation- Fires
- On State Start · During State · On State Exit
Description
Sets the local position of a specified child object.
Parameters
| Name | Type | Description |
|---|---|---|
childName | string | Name of the child GameObject under this item to move. Case-sensitive. |
x | number | Local-space X coordinate relative to the parent item, in meters. |
y | number | Local-space Y coordinate relative to the parent item, in meters. |
z | number | Local-space Z coordinate relative to the parent item, in meters. |
Side effects
- Calls
$.subNode(childName).setPosition(...)— moves the child's local-space transform. The parent item itself is unaffected. - Does not require
MovableItemon the parent; sub-node positioning goes through CCK's sub-node API, which is independent of the movable-item permission system. - If the named child doesn't exist or doesn't expose
setPosition, the runtime logs a warning and the call is a no-op. Spelling and capitalization ofchildNamemust match the GameObject's name exactly. - No state keys are written, no signals fired, and
$.groupStateis untouched. The change is purely visual and networked to all players.
Example
In Concepts → State machine lifecycle and Reference → Variables, this action drives a within-subjects depth manipulation by placing the ColorBox (or Stimulus) child sub-node closer to or farther from the participant per trial:
// On State Start
SetChildPosition("Stimulus", 0, CONDITION["depth"] === "near" ? 1.5 : 3.0, 0);When the item is a wrapper that owns several sub-elements (e.g., a stimulus card with separate Stimulus, Caption, and Border children), moving the child instead of the parent lets you keep the wrapper's transform stable while reconfiguring its visual contents.
Related
AddChildPosition(childName, x, y, z)— relative offset instead of absolute local position.SetChildRotation(childName, x, y, z)— the rotation counterpart on the same sub-node.SetPosition(x, y, z)— when you want to move the whole item instead of a sub-node (requiresMovableItem).- Reference → Variables →
CONDITION— usingCONDITIONto pick per-trial positions.
Source
Assets/Doc/LUIDA-StateListeningItemScriptDoc.md
Original markdown body
- **Description**: Sets the local position of a specified child object.
- **Parameters**:
- `childName`: `string`
- `x`: `number`
- `y`: `number`
- `z`: `number`