API Reference

GestureProvider.cs

class GestureProvider

This is the main class used for hand detection. It handles start/stop of the detection automatically once the script is enabled.

GestureProvider is a singleton class, make sure there is one and only one instance in the whole scene. It provides several static readonly properties about detection status and result.

static GestureResult LeftHand { get; }

Get detection result of left hand. Returns null if left hand is not detected.

static GestureResult RightHand { get; }

Get detection result of right hand. Returns null if right hand is not detected.

static GestureStatus Status { get; }

Returns running status of hand detection.

static GestureFailure Error { get; }

Returns detailed error if Status is GestureStatus.Error.

static GestureProvider Current { get; }

Returns the current singleton (or null if no instance exists).

static GestureMode Mode { get; }

Current running mode for detection, value is only valid if Status is GestureStatus.Starting or GestureStatus.Running.

static Boolean HaveSkeleton { get; }

A shortcut for checking skeleton mode. Equivalent to Status == GestureMode.Skeleton.

GestureInterface.cs

class GestureOption

Class containing options for starting detection

GestureBackend backend { get; set; }

Backend of detection, default is GestureBackend.Auto.

Note

GestureBackend is deprecated and will be removed in future release.

GestureMode mode { get; set; }

Mode of detection, default is GestureMode.Skeleton.

Note

GestureMode is deprecated, skeleton mode will be the only supported mode in future release. If you want to use other modes, use GestureResult.position.

Int32 maxFPS { get; set; }

Limit max fps of raw detection, only used when value in range [15, 90], default is 90.

Note

This has negative impact on latency. Only use it when VR application fps slows down due to hand tracking.

class GestureResult

Class containing detection result for one hand.

Boolean isLeft { get; }

Returns if this hand is left/right.

Vector3[] points { get; }

Returns position of the hand joints. This field is guaranteed to be not null. Meaning of this field is different based on actual GestureMode.

Quaternion[] rotations { get; }

Returns rotation of the hand joints. This field is guaranteed to be not null. Meaning of this field is different based on actual GestureMode.

Identity rotation (assume hand is five gesture): palm face front and fingers point upward.

GestureType gesture { get; }

Returns pre-defined gesture type.

Vector3 position { get; }

Returns position of palm center, use this if only need hand position instead of 21 joints.

Quaternion rotation { get; }

Returns rotation of palm center.

Single confidence { get; }

Returns confidence of the hand, within [0, 1].

PinchInfo pinch { get; }

Returns information of pinch (index and thumb) finger, includig pinch level and directions.

class PinchInfo

Struct containing information of pinch.

Single pinchLevel { get; set; }

Returns pinch (thumb & index) level of the hand, within [0, 1], higher means more possible to pinch. If you only need a boolean value for pinch or not, you can use isPinching instead.

Boolean isPinching { get; }

Returns if currently pinching or not. If you need a range value within [0, 1], you can use pinchLevel instead. Equivalent to pinchLevel > 0.7f.

Vector3 pinchStart { get; set; }

Returns start position of the pinch ray.

Vector3 pinchDirection { get; set; }

Returns forward direction of the pinch ray.

Quaternion pinchRotation { get; }

Returns rotation of the pinch ray. If only need a forward direction, you can use pinchDirection instead.

enum GestureBackend

Enum for selecting computation backend.

Auto

Default backend, use GPU on PC and CPU on Android. Recommended.

CPU

Use CPU, not supported on PC

GPU

Use GPU, supported on PC/Android

enum GestureMode

Enum for detection mode. Larger mode return more info, but runs more slowly. If a mode is not supported on a device, will fallback to previous supported mode.

See also

See Hand Positions & Rotations (Modes) section for detailed modes description.

Point2D

Fastest mode, return one 2d point for hand, supported on all devices.

Point3D

Return one 3d point for hand, supported on all dual camera devices.

Skeleton

Return skeleton (21 points) for hand, supported on all devices.

enum GestureType

Enum for predefined gesture classification.

See also

See Pre-defined gesture classification section for detailed gesture description.

Unknown

All other gestures not in predefined set.

Point

Only index finger straight and upward.

Fist

All fingers folded.

OK

Thumb and index fingers connect into a circle, other fingers straight.

Like

Only thumb straight and upward.

Five

All fingers straight.

Victory

Only index and middle finger straight and upward.

enum GestureFailure

Enum for possible errors in hand detection.

None

No error occurs.

OpenCL

(Only on Windows) OpenCL is not supported on the machine.

See also

See Notes for Windows for possible solutions.

Camera

Start camera failed. This happens if Vive Hand Tracking SDK failed to get camera frames.

  • Windows: See Camera Setup for possible solutions.
  • Android phone & WaveVR: Make sure camera permission is granted before start detection.
    • Some phones does not support NDK Camera2 API (or return no cameras in API).
    • Most WaveVR devices other than Vive Focus does not support camera API yet.
    • Make sure WaveVR plugin is imported for non-WaveVR project.
Internal

Internal errors.

CPUOnPC

CPU backend is not supported on Windows. Please use different backend when you start detection.

enum GestureStatus

Enum for possible status in gesture detection.

NotStarted

Detection is not started or stopped.

Starting

Detection is started, but first result is not returned yet.

Running

Detection is running and updates result regularly.

Error

Detection failed to start, or error occured during detection.

CustomGestureProvider.cs

class CustomGestureProvider

This is the main class used for custom gesture definition.

CustomGestureProvider is a singleton class, make sure there is at most one instance in the whole scene.

static CustomGestureProvider Current { get; }

Returns the current singleton (or null if no instance exists).

static HandState LeftHandState { get; }

Get finger close/open states of left hand. Returns null if left hand is not detected or GestureProvider.Mode != GestureMode.Skeleton.

static HandState RightHandState { get; }

Get finger close/open states of right hand. Returns null if right hand is not detected or GestureProvider.Mode != GestureMode.Skeleton.

List<BaseSingleHandGestureProducer> SingleHandCustomGestures { get; }

Returns all defined single hand custom gestures.

List<BaseDualHandGestureProducer> DualHandCustomGestures { get; }

Returns all defined dual hand custom gestures.

class HandState

Struct containing finger close/open states of one hand.

ThumbState thumb { get; set; }

State for thumb.

FingerState index { get; set; }

State for index.

FingerState middle { get; set; }

State for middle.

FingerState ring { get; set; }

State for ring.

FingerState pinky { get; set; }

State for pinky.

enum ThumbState

Enum for thumb state close/open state.

Close
Open
enum FingerState

Enum for possible finger state, used for non-thumb fingers.

Close
Relax
Open

CustomGestureProducer.cs

class BaseSingleHandGestureProducer

Defines a custom gesture that needs one hand to trigger.

Boolean IsLeftMatch { get; }

Returns true if this gesture is triggering for left hand.

Boolean IsRightMatch { get; }

Returns true if this gesture is triggering for right hand.

class BaseDualHandGestureProducer

Defines a custom gesture that needs both hands to trigger. This implies both hands are detected.

Boolean IsMatch { get; }

Returns true if this gesture is triggering.