API Reference

GestureProvider.cs

class GestureProvider

This is a the main class used for gesture 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 gesture detection.

static GestureFailure Error { get; }

Returns detailed error if Status is GestureStatus.Error.

static Boolean UpdatedInThisFrame { get; }

Returns true if LeftHand and RightHand are updated in this frame. This can be useful for calculating states that only depends on hand result. Since Vive Hand Tracking SDK normally have slower FPS than VR rendering, it saves computation power if these states are only updated when hand results change.

Always return false if detection is not running.

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 2D 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.

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 Vive Pro and Focus.

Skeleton

Return skeleton (21 points) for hand, supported on Vive and Vive Pro.

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
enum GestureFailure

Enum for possible errors in gesture 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 in SteamVR 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().