@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() ​
status(): HandTrackingStatus;Defined in: hands/tracker.ts:161
"loading" until the detector is up, then "ready", or "failed" if it couldn't start.
Returns ​
error() ​
error(): string | null;Defined in: hands/tracker.ts:163
Why it failed, for a person.
Returns ​
string | null
list() ​
list(): readonly Hand[];Defined in: hands/tracker.ts:165
Every hand in view.
Returns ​
readonly Hand[]
get() ​
get(side): Hand | null;Defined in: hands/tracker.ts:167
That hand if it's in view, or else null.
Parameters ​
| Parameter | Type |
|---|---|
side | HandSide |
Returns ​
Hand | null
first() ​
first(): Hand | null;Defined in: hands/tracker.ts:169
The hand that's been in view longest, or null.
Returns ​
Hand | null
isPose() ​
isPose(pose, side?): boolean;Defined in: hands/tracker.ts:171
Whether a hand is holding a pose. With no side, either hand.
Parameters ​
| Parameter | Type |
|---|---|
pose | HandPoseName |
side? | HandSide |
Returns ​
boolean
didGesture() ​
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 ​
| Parameter | Type |
|---|---|
name | HandGestureName |
side? | HandSide |
Returns ​
boolean
on() ​
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 ​
| Parameter | Type |
|---|---|
name | "*" | HandGestureName |
listener | (event) => void |
Returns ​
attach() ​
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 ​
| Parameter | Type |
|---|---|
entityId | number |
options? | HandAttachOptions |
Returns ​
void
detach() ​
detach(entityId): void;Defined in: hands/tracker.ts:178
Parameters ​
| Parameter | Type |
|---|---|
entityId | number |
Returns ​
void
stats() ​
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>

