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.

EViveHandTrackingMode StartDetection(EViveHandTrackingMode ChoosedMode)

Start detection with choosed mode. Return value is the actual mode used in detection, since not all modes are supported on the device.

void StopDetection()

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

const FViveHandTrackingResult &GetLeftHand() const

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

const FViveHandTrackingResult &GetRightHand() const

Get detection result of right hand. Use FViveHandTrackingResult::isValid 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 GetLastIndex() 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 USingleHandGestureProducer : public UActorComponent

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 UActorComponent

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 isValid

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

TArray<FVector> SpawnPoints

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

  • EViveHandTrackingMode::Point2D

    Size is 1, which indicates the 2D position of hand. The position is always 0.25m in front of camera.

  • EViveHandTrackingMode::Point3D

    Size is 1, which indicates the 3D position of hand.

  • EViveHandTrackingMode::Skeleton

    Size is 21 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 x == 0 && y == 0 && z == 0 to check if a keypoint is valid.

FVector position

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

FRotator rotation

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

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

bool isPinching

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.

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

enumerator Point2D = 0

Fastest mode, return one 2d point for hand.

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 PC and Focus.

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
enumerator Fist = 2
enumerator OK = 3
enumerator Like = 4
enumerator Five = 5
enumerator Victory = 6
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.
enumerator Internal = 10

Internal errors.

enumerator CPUOnPC = 11

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