API Reference¶
GestureProvider.cs¶
-
class GestureProvider
¶ This is the main class used for hand 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 hand detection.
-
static GestureFailure
Error
{ get; }¶ Returns detailed error if
Status
isGestureStatus.Error
.
-
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
isGestureStatus.Starting
orGestureStatus.Running
.
-
static Boolean
HaveSkeleton
{ get; }¶ A shortcut for checking skeleton mode. Equivalent to
Status
==GestureMode.Skeleton
.
-
static GestureResult
GestureInterface.cs¶
-
class GestureOption
¶ Class containing options for starting detection
-
GestureBackend
backend
{ get; set; }¶ Backend of detection, default is
GestureBackend.Auto
.Note
GestureBackend is deprecated and will be removed in future release.
-
GestureMode
mode
{ get; set; }¶ Mode of detection, default is
GestureMode.Skeleton
.Note
GestureMode is deprecated, skeleton mode will be the only supported mode in future release. If you want to use other modes, use
GestureResult.position
.
-
GestureBackend
-
class GestureResult
¶ Class containing detection result for one hand.
-
Vector3[]
points
{ get; }¶ Returns position of the hand joints. This field is guaranteed to be not null. Meaning of this field is different based on actual
GestureMode
.-
Only first point is used as the 2D position of hand. Position is always 0.25m in front of camera.
-
Only first point is used as the 3D position of hand.
-
The points is a 21-sized array with all the keypoints of the hand. See Hand Positions & Rotations (Modes) for order of the keypoints.
-
-
Quaternion[]
rotations
{ get; }¶ Returns rotation of the hand joints. This field is guaranteed to be not null. Meaning of this field is different based on actual
GestureMode
.GestureMode.Point2D
&GestureMode.Point3D
Only first element is used as the the rotation of hand.
-
A 21-sized array of rotation of all the keypoints.
Identity rotation (assume hand is five gesture): palm face front and fingers point upward.
-
GestureType
gesture
{ get; }¶ Returns pre-defined gesture type.
-
Vector3
position
{ get; }¶ Returns position of palm center, use this if only need hand position instead of 21 joints.
-
Quaternion
rotation
{ get; }¶ Returns rotation of palm center.
-
Vector3[]
-
class PinchInfo
¶ Struct containing information of pinch.
-
Single
pinchLevel
{ get; set; }¶ 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.
-
Boolean
isPinching
{ get; }¶ Returns if currently pinching or not. If you need a range value within [0, 1], you can use
pinchLevel
instead. Equivalent topinchLevel
> 0.7f.
-
Quaternion
pinchRotation
{ get; }¶ Returns rotation of the pinch ray. If only need a forward direction, you can use
pinchDirection
instead.
-
Single
-
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 & Rotations (Modes) section for detailed modes description.
-
Point2D
¶ Fastest mode, return one 2d point for hand, supported on all devices.
-
Point3D
¶ Return one 3d point for hand, supported on all dual camera devices.
-
Skeleton
¶ Return skeleton (21 points) for hand, supported on all devices.
-
-
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
¶ Only index finger straight and upward.
-
Fist
¶ All fingers folded.
-
OK
¶ Thumb and index fingers connect into a circle, other fingers straight.
-
Like
¶ Only thumb straight and upward.
-
Five
¶ All fingers straight.
-
Victory
¶ Only index and middle finger straight and upward.
-
-
enum GestureFailure
¶ Enum for possible errors in hand 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 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 imported for non-WaveVR project.
-
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.
-
CustomGestureProvider.cs¶
-
class CustomGestureProvider
¶ This is the main class used for custom gesture definition.
CustomGestureProvider is a singleton class, make sure there is at most one instance in the whole scene.
-
static CustomGestureProvider
Current
{ get; }¶ Returns the current singleton (or null if no instance exists).
-
static HandState
LeftHandState
{ get; }¶ Get finger close/open states of left hand. Returns null if left hand is not detected or
GestureProvider.Mode
!=GestureMode.Skeleton
.
-
static HandState
RightHandState
{ get; }¶ Get finger close/open states of right hand. Returns null if right hand is not detected or
GestureProvider.Mode
!=GestureMode.Skeleton
.
-
List<BaseSingleHandGestureProducer>
SingleHandCustomGestures
{ get; }¶ Returns all defined single hand custom gestures.
-
List<BaseDualHandGestureProducer>
DualHandCustomGestures
{ get; }¶ Returns all defined dual hand custom gestures.
-
static CustomGestureProvider
-
class HandState
¶ Struct containing finger close/open states of one hand.
-
ThumbState
thumb
{ get; set; }¶ State for thumb.
-
FingerState
index
{ get; set; }¶ State for index.
-
FingerState
middle
{ get; set; }¶ State for middle.
-
FingerState
ring
{ get; set; }¶ State for ring.
-
FingerState
pinky
{ get; set; }¶ State for pinky.
-
ThumbState