@realitycollective/webxr-input
Interfaces
| Interface | Description |
|---|---|
| HeadPose | A viewer (head) pose sample - camera on desktop, HMD in XR. |
| HeadPoseSource | Supplies the viewer pose each frame. |
| InputCapabilities | - |
| InputHitHint | A pre-resolved interaction hint from providers whose engine performs its own targeting (e.g. Meta IWSDK delivers hover/press as ECS tag transitions rather than exposing a raycast query). When a provider supplies hints for a frame, a consumer's binder accepts them IN PLACE of its own hit-testing for the named target - provider power wins when the provider has extended capabilities. |
| InputProvider | The one interface an engine adapter must implement to feed input into the Reality Collective extension families. |
| InputProviderContractCase | One check an InputProvider implementation must pass. run returns silently on success and throws an Error describing the failure otherwise, so any test runner can host it. |
| InputProviderContractDriver | Optional hooks a contract case can drive. An adapter's test harness supplies whatever it can fake; cases that need a missing hook pass without running, so a partial driver is always safe. |
| InputSourceSnapshot | One live input source, engine-normalised and sampled once per update. Fields the provider cannot supply are simply absent - consumers gate on InputCapabilities, not on per-frame presence checks. |
| PointerInputSource | Delivers press-move-release for one interaction source. |
| PointerSample | One pointer/ray interaction stream, engine-normalised. |
| PoseTuple | A world-space pose. |
| RayTuple | A ray in world space; direction is expected normalised. |
Type Aliases
| Type Alias | Description |
|---|---|
| GrabCapability | How grabbing is fulfilled: - "none" - no grab input at all. - "poseOnly" - the provider reports grab start/end + poses; the consumer (or the interactions core) moves the object. - "native" - the engine owns carry/throw (e.g. IWSDK grabbables + physics); the provider reports the transitions and observed poses only. |
| Handedness | - |
| InputCapabilityRequirement | The input requirements a consumer (an interaction behaviour) can declare. Checked against InputCapabilities by capability negotiation. |
| InputSourceKind | What kind of physical thing produced this source. |
| PresenceModality | Which visuals a provider should present for the user's own body: - "hands" - hand meshes only. - "controllers" - controller models only. - "auto" - let the runtime decide from the live session. |
| QuatTuple | Orientation quaternion as [x, y, z, w]. |
| Unsubscribe | Returned by every subscription; call to detach the listener. |
| Vec3Tuple | Position as [x, y, z] in meters, world space unless stated otherwise. |
Variables
| Variable | Description |
|---|---|
| INPUT_CAPABILITY_REQUIREMENTS | Every requirement a consumer (an interaction behaviour) can declare, as runtime data so a test can check it against the keys of NO_CAPABILITIES. Every capability appears here, and "grabs" is the one capability with two requirements. |
| NO_CAPABILITIES | A provider with nothing to give - the safe default before a session. |
| SELECT_PRESS_THRESHOLD | Select threshold used by consumers that need a boolean from select. |
| SELECT_RELEASE_THRESHOLD | Release threshold (hysteresis below the press threshold). |
Functions
| Function | Description |
|---|---|
| inputProviderContractCases | The shared provider conformance suite, runner-free on purpose: every adapter repository has its own runner, so this ships the checks as data and the adapter iterates them. A typical suite is three lines: |
| satisfies | True when capabilities satisfies a single requirement. |
| unmetRequirements | The subset of requirements that capabilities does NOT satisfy. |
| velocityBetween | Grip velocity derived from two consecutive poses - the throw/flick input every physics-flavoured grab needs, for the many providers that report poses but no velocity. Pure and dependency-free: the caller keeps the previous pose, this turns the pair into a velocity. |