@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / XrInputState
Type Alias: XrInputState ​
ts
type XrInputState = {
handedness: XrHandedness;
kind: XrInputKind;
connected: boolean;
rayOrigin: THREE.Vector3;
rayDirection: THREE.Vector3;
gripPosition: THREE.Vector3 | null;
gripQuaternion: THREE.Quaternion | null;
select: boolean;
selectStart: boolean;
selectEnd: boolean;
squeeze: boolean;
squeezeStart: boolean;
squeezeEnd: boolean;
axes: number[];
hasAxes: boolean;
buttons: boolean[];
joints: XrHandJoints | null;
};Defined in: xr/types.ts:44
One frame of normalized input for a single source.
Boolean actions follow the same pending→latched contract as the desktop InputSystem: select is the held state, while selectStart / selectEnd are true for exactly one frame. This lets Behaviours poll (if (select)) or edge-detect (if (selectStart)) without subscribing to events.
Properties ​
| Property | Type | Description | Defined in |
|---|---|---|---|
handedness | XrHandedness | - | xr/types.ts:45 |
kind | XrInputKind | - | xr/types.ts:46 |
connected | boolean | False once the source disconnects (a released pinch on Vision Pro). | xr/types.ts:48 |
rayOrigin | THREE.Vector3 | Pointing ray in WORLD space, from the source's targetRaySpace. | xr/types.ts:50 |
rayDirection | THREE.Vector3 | - | xr/types.ts:51 |
gripPosition | THREE.Vector3 | null | Physical grip pose. Null for gaze and transient-pointer, which have no grip. | xr/types.ts:53 |
gripQuaternion | THREE.Quaternion | null | - | xr/types.ts:54 |
select | boolean | Primary action: controller trigger, hand pinch, or Vision Pro gaze-pinch. | xr/types.ts:56 |
selectStart | boolean | - | xr/types.ts:57 |
selectEnd | boolean | - | xr/types.ts:58 |
squeeze | boolean | Secondary action: controller grip squeeze. Never fires for hands/gaze. | xr/types.ts:60 |
squeezeStart | boolean | - | xr/types.ts:61 |
squeezeEnd | boolean | - | xr/types.ts:62 |
axes | number[] | Thumbstick / trackpad axes in [-1, 1]. Empty when hasAxes is false. | xr/types.ts:64 |
hasAxes | boolean | True only for sources with a physical stick — gates stick-driven locomotion. | xr/types.ts:66 |
buttons | boolean[] | Raw gamepad button pressed-states, when the source exposes a gamepad. | xr/types.ts:68 |
joints | XrHandJoints | null | Tracked hand joint positions, world space, or null for controllers. Positions only — pose matching is position-based so it works identically against WebXR, a simulator, or a recorded hand. | xr/types.ts:76 |

