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 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. This field is guaranteed to be not null. The meaning of this field is different based on actual GestureMode.

  • GestureMode.Point2D

    Only first point is used as the 2D position of hand. Position is always 0.25m in front of camera.

  • GestureMode.Point3D

    Only first point is used as the 3D position of hand.

  • GestureMode.Skeleton

    The points is a 21-sized array with all the keypoints of the hand. See Hand Positions (Modes) for order of the keypoints.

    Note

    Some keypoints may be missing due to occulusion from other objects or hand itself. In such cases, a place-holder position is returned which cannot be used as real position. Use GestureHelper.IsValidGesturePoint to check if a keypoint is valid.

GestureType gesture { get; }

Returns pre-defined gesture type.

Vector3 position { get; }

Returns position of the hand. The meaning of this field is different based on actual GestureMode.

Quaternion rotation { get; }

Returns rotation of the hand. The meaning of this field is different based on actual GestureMode.

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 (Modes) section for detailed modes description.

Point2D

Fastest mode, return one 2d point for hand.

Point3D

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

Skeleton

Return skeleton (21 points) for hand, supported on PC and Focus.

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
Fist
OK
Like
Five
Victory
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.
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.

class GestureHelper

Helper class for extension methods.

static Boolean IsValidGesturePoint (Vector3 point)

Test if a point in skeleton is valid or not. This function can be used as point.IsValidGesturePoint().

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.