@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / XRInteractionSystem
Class: XRInteractionSystem ​
Defined in: systems/XRInteractionSystem.ts:107
Implements ​
Constructors ​
Constructor ​
new XRInteractionSystem(inputSystem): XRInteractionSystem;Defined in: systems/XRInteractionSystem.ts:125
Parameters ​
| Parameter | Type |
|---|---|
inputSystem | XRInputSystem |
Returns ​
XRInteractionSystem
Properties ​
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
runsWhilePaused | readonly | true | true | Hover only while paused: see updatePaused. | systems/XRInteractionSystem.ts:109 |
Methods ​
update() ​
update(world, deltaTime): void;Defined in: systems/XRInteractionSystem.ts:129
Parameters ​
| Parameter | Type |
|---|---|
world | World |
deltaTime | number |
Returns ​
void
Implementation of ​
releaseEntity() ​
releaseEntity(world, entityId): void;Defined in: systems/XRInteractionSystem.ts:898
Let go of an entity in every hand, without a throw: for when the hand can't keep it, such as another player already holding it.
Parameters ​
| Parameter | Type |
|---|---|
world | World |
entityId | number |
Returns ​
void
getHoveredEntityId() ​
getHoveredEntityId(): number | null;Defined in: systems/XRInteractionSystem.ts:1031
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:1041
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:1051
Every entity under a pointer this frame — drives hover feedback.
Returns ​
Set<number>
getHeldEntityIds() ​
getHeldEntityIds(): Set<number>;Defined in: systems/XRInteractionSystem.ts:1058
Entities currently held, so hover feedback can skip them.
Returns ​
Set<number>
isGrabbing() ​
isGrabbing(): boolean;Defined in: systems/XRInteractionSystem.ts:1065
True when any source is holding something.
Returns ​
boolean
isSourceBusy() ​
isSourceBusy(world, input): boolean;Defined in: systems/XRInteractionSystem.ts:1083
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:1114
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:1122
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:1129
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:1144
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:1145 |
primaryHandedness | XrHandedness | null | - | systems/XRInteractionSystem.ts:1146 |
secondaryHandedness | XrHandedness | null | - | systems/XRInteractionSystem.ts:1147 |
handSeparation | number | null | Metres between the hands, or null unless two hands are on it. | systems/XRInteractionSystem.ts:1149 |
attachPointIds | (string | null)[] | The attach point ids in use, in holder order. | systems/XRInteractionSystem.ts:1151 |
null

