AddPosition
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.
AddPosition(x, y, z)StableItem Manipulation- Fires
- On State Start · During State · On State Exit
Description
Offsets the item's world position. Requires the MovableItem component on this item.
Parameters
| Name | Type | Description |
|---|---|---|
x | number | World-space X offset, in meters. |
y | number | World-space Y offset, in meters. |
z | number | World-space Z offset, in meters. |
Side effects
- Reads the item's current world position from the CCK
MovableItemAPI, adds the supplied offset, and writes the new position back. The networked transform is updated for every player in the room. - Requires the item to have a
MovableItemcomponent. Without it, the runtime logs a warning and the call is a no-op. - No state keys are written, no signals fired, and
$.groupStateis untouched. - Repeated
AddPositioncalls accumulate. If you want to "nudge then return" semantics, pair anOn State StartAddPositionwith an equal-and-oppositeOn State ExitAddPosition.
Example
A simple cue-bobbing pattern: nudge a stimulus upward on state entry, then back down on exit, to draw attention without moving it to a fixed spot:
// On State Start
AddPosition(0, 0.1, 0);
// On State Exit
AddPosition(0, -0.1, 0);For a step-change setup, prefer SetPosition so the new pose doesn't depend on whatever the previous pose happened to be.
Related
SetPosition(x, y, z)— absolute world position; what you usually want when placing a stimulus precisely per trial.AddChildPosition(childName, x, y, z)— offset a named sub-node instead of the whole item.AddRotation(x, y, z)— the rotation counterpart forAddPosition.- Concepts → State machine lifecycle —
On State Start/On State Exitsemantics.
Source
Assets/Doc/LUIDA-StateListeningItemScriptDoc.md
Original markdown body
- **Description**: Offsets the item's world position. **Requires the `MovableItem` component on this item.**
- **Parameters**:
- `x`: `number`
- `y`: `number`
- `z`: `number`