LUIDA Docs

PARTICIPANTS

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.

PARTICIPANTSStableAvailable Variables
Fires
On State Start · During State · On State Exit

Description

PARTICIPANTS is a 1-indexed array of CCK PlayerHandle objects — one per participant currently in the session. Use it for any per-participant operation: looking up positions, dispatching haptics, sending side-channel messages, reading bone transforms. The 1-indexing matches LUIDA's pID numbering everywhere else (the Web Console, the data exports, the participant manager), so PARTICIPANTS[1] is "participant 1" — not the second participant.

Parameters

Not a function. Indexed as PARTICIPANTS[n] where n is a 1-based participant index.

Side effects

  • Reads only — no writes, no signals. Iterating or reading from PARTICIPANTS doesn't change experiment state.
  • The array is populated by ParticipantManager once the session has started and stays stable for the duration. Early-init code (before participant manager has run) may see an empty array.
  • PARTICIPANTS[0] is undefined — the 1-indexed convention bites JavaScript programmers more often than any other LUIDA quirk. Always start indexing at 1.
  • Disconnects don't shift other indices: if participant 2 leaves, PARTICIPANTS[2] becomes undefined (or a stale handle that throws on use). Always guard if (PARTICIPANTS[n]) before calling methods.
  • The full method set on each handle is in Assets/Doc/CCK-Types.d.ts under PlayerHandle — bone positions, send/receive, teleport, kick, etc.

Example

Dispatch a 100 ms right-controller haptic to participant 1 (the most common single-participant pattern):

const p1 = PARTICIPANTS[1];
if (p1) {
  p1.send("haptics", { target: "right", frequency: 200, amplitude: 0.7, duration: 0.1 });
}

Read participant 2's head world position in a paired study (pNum=2):

const p2 = PARTICIPANTS[2];
if (p2) {
  const headPos = p2.getHumanoidBonePosition(HumanoidBone.Head);
  // ...do something with headPos
}

When you only need to address the player from a higher-level action like SendHaptics or AssignAvatarToParticipant, you pass the participant index directly and the action resolves through PARTICIPANTS internally — you don't have to touch the array.

Source

Assets/Doc/LUIDA-StateListeningItemScriptDoc.md

Original markdown body
- An array of PlayerHandle of the participants joining this experiment."
- Use `PARTICIPANTS[1]` to retrieve the first participant, `PARTICIPANTS[2]` to retrieve the second participant, etc.