LUIDA Docs

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

NameTypeDescription
childNamestringName of the child GameObject under this item to move. Case-sensitive.
xnumberLocal-space X coordinate relative to the parent item, in meters.
ynumberLocal-space Y coordinate relative to the parent item, in meters.
znumberLocal-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 MovableItem on 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 of childName must match the GameObject's name exactly.
  • No state keys are written, no signals fired, and $.groupState is 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.

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`