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.
-
ViveHandTrackingMode
StartDetection(ViveHandTrackingMode 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::isValidto check if hand is valid.
-
const FViveHandTrackingResult &
GetRightHand() const¶ Get detection result of right hand. Use
FViveHandTrackingResult::isValidto check if hand is valid.
-
const ViveHandTrackingStatus &
GetStatus() const¶ Returns running status of hand detection.
-
const ViveHandTrackingFailure &
GetError() const¶ Returns detailed error if
GetStatus()isViveHandTrackingStatus::Error.
-
const ViveHandTrackingMode &
GetMode() const¶ Current running mode for detection, value is only valid if
GetStatus()isViveHandTrackingStatus::StartingorViveHandTrackingStatus::Running.
-
const bool
UpdatedInThisFrame() const¶ Returns true if
GetLeftHand()andGetRightHand()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.
-
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.
-
ViveHandTrackingMode
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
ViveHandTrackingMode.-
Size is 1, which indicates the 2D position of hand. The position is always 0.25m in front of camera.
-
Size is 1, which indicates the 3D position of hand.
ViveHandTrackingMode::SkeletonSize 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.
-
-
ViveHandTrackingType
gestureType¶ Returns pre-defined gesture type.
-
bool
Enums¶
-
enum class
ViveHandTrackingMode: 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.
-
enumerator
-
enum class
ViveHandTrackingType: 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¶
-
enumerator
-
enum class
ViveHandTrackingStatus: 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.
-
enumerator
-
enum class
ViveHandTrackingFailure: 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.
-
enumerator