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()
isEViveHandTrackingStatus::Error
.
-
const EViveHandTrackingMode &
GetMode
() const¶ Current running mode for detection, value is only valid if
GetStatus()
isEViveHandTrackingStatus::Starting
orEViveHandTrackingStatus::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.
-
void
-
class
UHandTrackingEngine
: public UObject¶ Base class for all engine implementation.
-
bool
IsSupported
()¶ Returns if engine is supported or not.
-
bool
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
.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 & Rotations (Modes) for order of the keypoints.
-
TArray<FRotator>
rotations
¶ Returns rotation of the hand joints. Meaning of this field is different based on actual
EViveHandTrackingMode
.EViveHandTrackingMode::Point2D
&EViveHandTrackingMode::Point3D
Size is 1, which indicates the rotation of hand.
EViveHandTrackingMode::Skeleton
Size is 21 with rotation of all the keypoints. See Hand Positions & Rotations (Modes) for order of the keypoints.
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.
-
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 topinchLevel
> 0.7f.
-
FRotator
pinchRotation
¶ Returns rotation of the pinch ray. If only need a forward direction, you can use
pinchDirection
instead.
-
bool
-
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
.
-
EViveHandTrackingMode
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.
-
enumerator
-
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.
-
enumerator
-
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.
-
enumerator
-
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.
-
enumerator