@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / XRInteractionSystem
Class: XRInteractionSystem ​
Defined in: systems/XRInteractionSystem.ts:104
Implements ​
Constructors ​
Constructor ​
new XRInteractionSystem(inputSystem): XRInteractionSystem;Defined in: systems/XRInteractionSystem.ts:120
Parameters ​
| Parameter | Type |
|---|---|
inputSystem | XRInputSystem |
Returns ​
XRInteractionSystem
Methods ​
update() ​
update(world, deltaTime): void;Defined in: systems/XRInteractionSystem.ts:124
Parameters ​
| Parameter | Type |
|---|---|
world | World |
deltaTime | number |
Returns ​
void
Implementation of ​
getHoveredEntityId() ​
getHoveredEntityId(): number | null;Defined in: systems/XRInteractionSystem.ts:950
Entity currently under a pointer this frame, or null.
Returns ​
number | null
getHoverFor() ​
getHoverFor(handedness):
| {
entityId: number;
distance: number;
}
| null;Defined in: systems/XRInteractionSystem.ts:960
What this hand is pointing at, with the distance to it.
The distance is what lets the pointer ray stop at the surface instead of passing through the object.
Parameters ​
| Parameter | Type |
|---|---|
handedness | XrHandedness |
Returns ​
| { entityId: number; distance: number; } | null
getHoveredEntityIds() ​
getHoveredEntityIds(): Set<number>;Defined in: systems/XRInteractionSystem.ts:970
Every entity under a pointer this frame — drives hover feedback.
Returns ​
Set<number>
getHeldEntityIds() ​
getHeldEntityIds(): Set<number>;Defined in: systems/XRInteractionSystem.ts:977
Entities currently held, so hover feedback can skip them.
Returns ​
Set<number>
isGrabbing() ​
isGrabbing(): boolean;Defined in: systems/XRInteractionSystem.ts:984
True when any source is holding something.
Returns ​
boolean
isSourceBusy() ​
isSourceBusy(world, input): boolean;Defined in: systems/XRInteractionSystem.ts:1002
Whether this input's primary action is committed to interaction.
True while the source holds something, and also while it merely HOVERS a grabbable — because the pinch that is about to grab must not be read as a teleport by the locomotion system. Without the hover half, the first pinch of a grab teleports the player, and so does the pinch that takes an object from the other hand.
Keyed on the INPUT SOURCE rather than handedness. Vision Pro reports handedness: "none" for every gaze-pinch (it is hard-coded in WebKit), so a handedness-keyed check silently never matched there and each pinch both grabbed and teleported.
Parameters ​
| Parameter | Type |
|---|---|
world | World |
input | XrInputState |
Returns ​
boolean
registerBusyContributor() ​
registerBusyContributor(contributor): void;Defined in: systems/XRInteractionSystem.ts:1033
OR-ed into isSourceBusy; see the comment there.
Parameters ​
| Parameter | Type |
|---|---|
contributor | (world, input) => boolean |
Returns ​
void
getHoverForInput() ​
getHoverForInput(input):
| {
entityId: number;
distance: number;
}
| null;Defined in: systems/XRInteractionSystem.ts:1041
Hover for a specific input source (handedness-free — Vision Pro's transient pointers all report handedness "none").
Parameters ​
| Parameter | Type |
|---|---|
input | XrInputState |
Returns ​
| { entityId: number; distance: number; } | null
isGrabbingWith() ​
isGrabbingWith(handedness): boolean;Defined in: systems/XRInteractionSystem.ts:1048
True when THIS hand is holding something.
Parameters ​
| Parameter | Type |
|---|---|
handedness | XrHandedness |
Returns ​
boolean
getGrabInfo() ​
getGrabInfo(entityId):
| {
hands: number;
primaryHandedness: XrHandedness | null;
secondaryHandedness: XrHandedness | null;
handSeparation: number | null;
attachPointIds: (string | null)[];
}
| null;Defined in: systems/XRInteractionSystem.ts:1063
How an entity is currently held.
Exposed for scripts: a Behaviour can poll this in onUpdate to drive two-hand-specific behaviour — showing a bipod when both hands are on a weapon, reading the live hand separation to gate a gesture, or reacting to the scale a pull-apart produced. Returns null when nothing holds it.
Parameters ​
| Parameter | Type |
|---|---|
entityId | number |
Returns ​
Type Literal ​
{
hands: number;
primaryHandedness: XrHandedness | null;
secondaryHandedness: XrHandedness | null;
handSeparation: number | null;
attachPointIds: (string | null)[];
}| Name | Type | Description | Defined in |
|---|---|---|---|
hands | number | - | systems/XRInteractionSystem.ts:1064 |
primaryHandedness | XrHandedness | null | - | systems/XRInteractionSystem.ts:1065 |
secondaryHandedness | XrHandedness | null | - | systems/XRInteractionSystem.ts:1066 |
handSeparation | number | null | Metres between the hands, or null unless two hands are on it. | systems/XRInteractionSystem.ts:1068 |
attachPointIds | (string | null)[] | The attach point ids in use, in holder order. | systems/XRInteractionSystem.ts:1070 |
null

