Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / TeleportAimGate

Class: TeleportAimGate ​

Defined in: xr/teleportAimGate.ts:17

Decides when a teleport may actually commit.

Teleport commits on RELEASE so the user can cancel by aiming away — the standard interaction. The trap is that a release edge alone is not evidence of intent: on hand tracking the SAME pinch drives grabbing, so the release that drops an object looks identical to the release that ends a teleport aim. Without this gate, letting go of a grabbed object teleports the player whenever the arc happens to land somewhere valid — and passing an object between hands does it too.

The rule is simply: a release only commits if this source engaged an aim first, and going busy (grabbing) discards any aim it had engaged.

Keyed per input source so the two hands are independent.

Constructors ​

Constructor ​

ts
new TeleportAimGate(): TeleportAimGate;

Returns ​

TeleportAimGate

Methods ​

update() ​

ts
update(
   source, 
   aiming, 
   releasing): boolean;

Defined in: xr/teleportAimGate.ts:25

Feed one frame for one source.

Parameters ​

ParameterType
sourceobject
aimingboolean
releasingboolean

Returns ​

boolean

whether the teleport should commit this frame.


isAiming() ​

ts
isAiming(source): boolean;

Defined in: xr/teleportAimGate.ts:42

True if this source currently has an aim engaged.

Parameters ​

ParameterType
sourceobject

Returns ​

boolean


cancel() ​

ts
cancel(source): boolean;

Defined in: xr/teleportAimGate.ts:54

Drop a source's aim without committing.

Called when a hand starts interacting, so the release that ends the grab cannot cash in an aim engaged before it.

Parameters ​

ParameterType
sourceobject

Returns ​

boolean

whether an aim was actually discarded.