Skip to main content

Variable: DockMode

const DockMode: {
BodyFollow: "body-follow";
HandLocked: "hand-locked";
HeadLocked: "head-locked";
WorldLocked: "world-locked";
};

Defined in: webxr-uiextensions/src/core/dock-state.ts:23

Dock state machine - pure logic, no engine imports.

A window is always in exactly one dock mode:

  • world-locked - placed in space; the window keeps its world transform.
  • body-follow - lazily follows the player (IWSDK Follower on the head), with a deadzone so it doesn't jitter.
  • head-locked - rigidly attached to the view (IWSDK ScreenSpace outside XR / a zero-tolerance follow inside XR). Use sparingly.
  • hand-locked - rides on a hand and shows while the palm is raised toward the viewer: a hand menu. Placement and the palm gate are hand-menu.ts; the window's handMenu options say which hand and where.

The state machine itself only decides WHICH engine ingredients a mode needs; DockSystem applies them (adding/removing Follower / ScreenSpace, or placing the window from a hand pose each frame). Keeping the decision pure makes every transition unit-testable without a headset or a renderer.

Type Declaration

NameTypeDefault valueDefined in
BodyFollow"body-follow"'body-follow'webxr-uiextensions/src/core/dock-state.ts:25
HandLocked"hand-locked"'hand-locked'webxr-uiextensions/src/core/dock-state.ts:27
HeadLocked"head-locked"'head-locked'webxr-uiextensions/src/core/dock-state.ts:26
WorldLocked"world-locked"'world-locked'webxr-uiextensions/src/core/dock-state.ts:24