Class Leap::Hands

class Leap.Hands

Static convenience methods and extension methods for getting useful Hand data.

Properties

static LeapProvider Provider { get; set; }

Static convenience accessor for a LeapProvider in the scene. Preference is given to a LeapServiceProvider if there is one.

If static memory currently has no reference for the provider (or if it was destroyed), this call will search the scene for a LeapProvider and cache it to be returned next time.

If there is no LeapProvider in your scene, this getter will return null. Be warned that calling this regularly can be expensive if LeapProviders often don’t exist in your scene or are frequently destroyed.

Public Static Functions

static LeapXRServiceProvider CreateXRLeapProviderManager ()

Assign a static reference to the most suitable provider in the scene.

Order:

static bool TryGetProviderAndChiralityFromHandModel (GameObject _handModelGameObject, out LeapProvider _provider, out Chirality _chirality)

Try to get the LeapProvider and Chirality of the HandModelBase component attached to this GameObject

Return

True if a HandModelBase exists. This can still return a null _provider if the HandModelBase has no LeapProvider

static Bone GetBone (this Finger finger, Bone.BoneType boneType)

Return the specified bone of the specified finger

Shorthand for finger.bones[(int)boneType],

static Bone GetBone (this Hand hand, Finger.FingerType fingerType, Bone.BoneType boneType)

Return the specified bone of the specified finger of the specificed hand

Shorthand for hand.Fingers[(int)fingerType].bones[(int)boneType],

static Finger GetFinger (this Hand hand, Finger.FingerType fingerType)

Return the specified finger of the specificed hand

Shorthand for hand.Fingers[(int)fingerType].Bones[],

static Pose GetPalmPose (this Hand hand)

Returns a Pose consisting of the tracked hand’s palm position and rotation.

static void SetPalmPose (this Hand hand, Pose newPalmPose)

As Hand.SetTransform(), but takes a Pose as input for convenience.

static Vector3 PalmarAxis (this Hand hand)

Returns the direction the Hand’s palm is facing. For the other two palm-basis directions, see RadialAxis and DistalAxis.

The direction out of the back of the hand would be called the dorsal axis.

static Vector3 RadialAxis (this Hand hand)

Returns the the direction towards the thumb that is perpendicular to the palmar and distal axes. Left and right hands will return opposing directions.

The direction away from the thumb would be called the ulnar axis.

static Vector3 DistalAxis (this Hand hand)

Returns the direction towards the fingers that is perpendicular to the palmar and radial axes.

The direction towards the wrist would be called the proximal axis.

static bool IsPinching (this Hand hand)

Returns whether the pinch strength for the hand is greater than 0.8. For more reliable pinch behavior, try applying hysteresis to the PinchDistance property.

static Vector3 GetPinchPosition (this Hand hand)

Returns approximately where the thumb and index finger will be if they are pinched together.

static Vector3 GetPredictedPinchPosition (this Hand hand)

Returns a decent approximation of where the hand is pinching, or where it will pinch, even if the index and thumb tips are far apart.

In general, this will be more stable than GetPinchPosition().

static Vector3 GetStablePinchPosition (this Hand hand)

Predicted Pinch Position without influence from the thumb or index tip. Useful for calculating extremely stable pinch calculations. Not good for visualising the pinch point - recommended to use PredictedPinchPosition instead

static bool IsFacing (this Vector3 facingVector, Vector3 fromWorldPosition, Vector3 towardsWorldPosition, float maxOffsetAngleAllowed)

Returns whether this vector faces from a given world position towards another world position within a maximum angle of error.

static float GetFistStrength (this Hand hand)

Returns a confidence value from 0 to 1 indicating how strongly the Hand is making a fist.

static float GetFingerStrength (this Hand hand, int finger)

Returns a confidence value from 0 to 1 indicating how strongly a finger is curled.

static float GetFingerPinchDistance (this Hand hand, int finger)

Returns the distance between the tip of the finger and the tip of the thumb. Finger 0 (thumb) will always return float.MaxValue.

static Chirality GetChirality (this Hand hand)

Returns the Chirality of the hand

static float CalculateHandScale (ref Hand hand)

Returns a relative scale to a default scale. Can be used to calculate palm width and pinch strength

static float CalculatePinchStrength (ref Hand hand)

Returns a pinch strength for the hand based on the provided joint data. Value ranges from 0 to 1 where 1 is fully pinched.

Only use this where the pinch strength has not already been provided. Alternatively, use the provided Hand.PinchStrength.

static float CalculatePinchDistance (ref Hand hand)

Returns a pinch distance (in m) for the hand based on the provided joint data.

Only use this where the pinch distance has not already been provided. Alternatively, use the provided Hand.PinchDistance.

static float CalculateGrabStrength (ref Hand hand)

Returns a grab strength for the hand based on the provided joint data. Value ranges from 0 to 1 where 1 is fully grabbed.

Only use this where the grab strength has not already been provided. Alternatively, use the provided Hand.GrabStrength.

static Ray HandRay (this Hand hand, Transform headTransform)

Returns an unsmoothed ray representing the general reaching/interaction intent direction.

static void Transform (this Bone bone, Vector3 position, Quaternion rotation)

Transforms a bone by a position and rotation.

static void Transform (this Finger finger, Vector3 position, Quaternion rotation)

Transforms a finger by a position and rotation.

static void Transform (this Hand hand, Vector3 position, Quaternion rotation)

Transforms a hand by a position and rotation.

static void Transform (this Frame frame, Vector3 position, Quaternion rotation)

Transforms a frame by a position and rotation.

static void SetTransform (this Bone bone, Vector3 position, Quaternion rotation)

Transforms a bone to a position and rotation.

static void SetTipTransform (this Finger finger, Vector3 position, Quaternion rotation)

Transforms a finger to a position and rotation by its fingertip.

static void SetTransform (this Hand hand, Vector3 position, Quaternion rotation)

Transforms a hand to a position and rotation.