Skip to content

@relu-interactives/spatial-ecs


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

Interface: Hands ​

Defined in: hands/tracker.ts:159

Hands, as a script reads them: this.hands in a project with hand tracking on, and null anywhere else.

Two sides mean two different things here, and each is named for what it is. hand.side is the person's own hand. hand.pictureSide is the side of the picture it's on. Gestures that move across the screen, like swipeLeft, are the picture's: left on screen on every camera, the same as the face.

Extended by ​

Methods ​

status() ​

ts
status(): HandTrackingStatus;

Defined in: hands/tracker.ts:161

"loading" until the detector is up, then "ready", or "failed" if it couldn't start.

Returns ​

HandTrackingStatus


error() ​

ts
error(): string | null;

Defined in: hands/tracker.ts:163

Why it failed, for a person.

Returns ​

string | null


list() ​

ts
list(): readonly Hand[];

Defined in: hands/tracker.ts:165

Every hand in view.

Returns ​

readonly Hand[]


get() ​

ts
get(side): Hand | null;

Defined in: hands/tracker.ts:167

That hand if it's in view, or else null.

Parameters ​

ParameterType
sideHandSide

Returns ​

Hand | null


first() ​

ts
first(): Hand | null;

Defined in: hands/tracker.ts:169

The hand that's been in view longest, or null.

Returns ​

Hand | null


isPose() ​

ts
isPose(pose, side?): boolean;

Defined in: hands/tracker.ts:171

Whether a hand is holding a pose. With no side, either hand.

Parameters ​

ParameterType
poseHandPoseName
side?HandSide

Returns ​

boolean


didGesture() ​

ts
didGesture(name, side?): boolean;

Defined in: hands/tracker.ts:173

That gesture fired on this frame. For a script that would rather poll than listen.

Parameters ​

ParameterType
nameHandGestureName
side?HandSide

Returns ​

boolean


on() ​

ts
on(name, listener): Unsubscribe;

Defined in: hands/tracker.ts:175

Calls listener each time a gesture fires, or any gesture with "*". Returns what takes it off.

Parameters ​

ParameterType
name"*" | HandGestureName
listener(event) => void

Returns ​

Unsubscribe


attach() ​

ts
attach(entityId, options?): void;

Defined in: hands/tracker.ts:177

Keeps an entity on a hand. Its Transform is written every frame until detach.

Parameters ​

ParameterType
entityIdnumber
options?HandAttachOptions

Returns ​

void


detach() ​

ts
detach(entityId): void;

Defined in: hands/tracker.ts:178

Parameters ​

ParameterType
entityIdnumber

Returns ​

void


stats() ​

ts
stats(): Record<string, number | string>;

Defined in: hands/tracker.ts:180

What the detector is costing, for a person looking at frame rate.

Returns ​

Record<string, number | string>