API Reference

Components

All the functions declared in the components are available in both C++ and blueprint.

class UViveHandTrackingComponent : public UActorComponent

This is a the component class used for hand detection. It provides functions to start/stop detection and get results.

void StartGestureDetection(UHandTrackingEngine *currentEngine, FViveHandTrackingOption option)

Start detection with choosed mode. Mode in option is modified to actual mode used in detection, since not all modes are supported on the device.

void StopGestureDetection()

Stop the detection. Blocking call until the pipeline is actually stopped.

void SelectEngine(FViveHandTrackingOption option)

Selects the engine to use. Must be called before StartGestureDetection.

const FViveHandTrackingResult &GetLeftHand() const

Get detection result of left hand. Use FViveHandTrackingResult::bIsValid to check if hand is valid.

const FViveHandTrackingResult &GetRightHand() const

Get detection result of right hand. Use FViveHandTrackingResult::bIsValid to check if hand is valid.

const EViveHandTrackingStatus &GetStatus() const

Returns running status of hand detection.

const EViveHandTrackingFailure &GetError() const

Returns detailed error if GetStatus() is EViveHandTrackingStatus::Error.

const EViveHandTrackingMode &GetMode() const

Current running mode for detection, value is only valid if GetStatus() is EViveHandTrackingStatus::Starting or EViveHandTrackingStatus::Running.

const int GetFrameIndex() const

Returns the frame index, which can be used to indicate detection status. Negative means stopped or error, 0 means starting, positive means up and running.

class UHandTrackingEngine : public UObject

Base class for all engine implementation.

bool IsSupported()

Returns if engine is supported or not.

class USingleHandGestureProducer : public UObject

Defines a custom gesture that needs one hand to trigger.

bool IsLeftMatch() const

Returns true if this gesture is triggering for left hand.

bool IsRightMatch() const

Returns true if this gesture is triggering for right hand.

class UDualHandGestureProducer : public UObject

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

bool IsMatch() const

Returns true if this gesture is triggering.

Structs

class FViveHandTrackingResult

Struct containing detection result for one hand.

bool bIsValid

Returns if this hand is valid (visible in camera) or not.

TArray<FVector> points

Returns position of the hand joints. Meaning of this field is different based on actual EViveHandTrackingMode.

TArray<FRotator> rotations

Returns rotation of the hand joints. Meaning of this field is different based on actual EViveHandTrackingMode.

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

FVector position

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

FRotator rotation

Returns rotation of palm center.

EViveHandTrackingType gestureType

Returns pre-defined gesture type.

float confidence

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

float pinchLevel

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 bIsPinching instead.

bool bIsPinching

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.

FVector pinchStart

Returns start position of the pinch ray.

FVector pinchDirection

Returns forward direction of the pinch ray.

FRotator pinchRotation

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

class FViveHandTrackingOption

Struct containing options for starting detection

EViveHandTrackingMode mode

Mode of detection, default is EViveHandTrackingMode::Skeleton.

Note

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

int32 maxFPS

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.

Enums

enum class EViveHandTrackingMode : uint8

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.

enumerator Point2D = 0

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

enumerator Point3D = 1

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

enumerator Skeleton = 2

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

enum class EViveHandTrackingType : uint8

Enum for predefined gesture classification.

See also

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

enumerator Unknown = 0

All other gestures not in predefined set.

enumerator Point = 1

Only index finger straight and upward.

enumerator Fist = 2

All fingers folded.

enumerator OK = 3

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

enumerator Like = 4

Only thumb straight and upward.

enumerator Five = 5

All fingers straight.

enumerator Victory = 6

Only index and middle finger straight and upward.

enum class EViveHandTrackingStatus : uint8

Enum for possible status in hand detection.

enumerator NotStarted = 0

Detection is not started or stopped.

enumerator Starting = 1

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

enumerator Running = 2

Detection is running and updates result regularly.

enumerator Error = 3

Detection failed to start, or error occured during detection.

enum class EViveHandTrackingFailure : uint8

Enum for possible errors in hand detection.

enumerator None = 0

No error occurs.

enumerator OpenCL = 1

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

See also

See Notes for Windows for possible solutions.

enumerator Camera = 2

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 not enabled for non-WaveVR project.
enumerator Internal = 10

Internal errors.

enumerator CPUOnPC = 11

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