Library functionsΒΆ
A C++ and Blueprint accessible library of utility functions for accessing Leap Motion device.
All positions & orientations are returned in Unreal reference frame & units, assuming the Leap device is located at the origin.
Public Static Functionsbool GetAllHandsIds(TArray< int32 > & OutAllHandIds)Returns list of IDs of all hands tracked by the device.
- Return
- True, if the device is connected.
- Parameters
- OutAllHandIds -
Output array which is filled with all the tracked hand IDs.
bool GetBonePostionAndOrientation(int32 HandId, ELeapBone LeapBone, FVector & OutPosition, FRotator & OutOrientation)Gets the position and orientation of the specified bone of the specified hand.
Data returned by this function is relative to the Unreal Engine origin rather than a particular LeapMotionControllerComponent or LeapMotionHandActor instance. Get the properties of a LeapMotionBoneActor instance to get the data relative to that actor’s parent hand actor and controller component. In this case, use the standard Unreal Actor location and rotation properties.
- Return
- True, if the hand with the specified id exists, false otherwise.
- Parameters
- HandId -
The id of the hand of interest.
- LeapBone -
The bone of interest.
- OutPosition -
An FVector set to the relative position of the hand, or a zero vector if a hand with the specified id does not exist.
- OutOrientation -
An FRotator set to the relative orientation of the specified bone, or a zero rotation if a hand with the specified id does not exist.
bool GetBoneWidthAndLength(int32 HandId, ELeapBone LeapBone, float & OutWidth, float & OutLength)Gets the width and length of the specified bone of the specified hand.
- Return
- True, if the hand with the specified id exists, false otherwise.
- Parameters
- HandId -
The id of the hand of interest.
- LeapBone -
The bone of interest.
- OutWidth -
A float set to the bone’s width (in centimeters).
- OutLength -
A float set to the bone’s length (in centimeters).
bool GetGrabStrength(int32 HandId, float & GrabStrength)The grab strength rating of the specified hand.
Grab strength is a rating of how the hand’s posture resembles a fist. A strength of 0 is close to an open, flat hand; a strength of 1 is close to a fist.
- Return
- True, if the hand with the specified id exists, false otherwise.
- Parameters
- HandId -
The id of the hand of interest.
- GrabStrength -
A float set to the hand’s grabbing strength as reported by Leap API.
bool GetOldestLeftOrRightHandId(ELeapSide LeapSide, int32 & OutHandId)Returns the oldest left- or right-hand actor, if one exists, nullptr otherwise.
If more than one left or right hand is being tracked, this function returns the one that has been tracked the longest.
- Return
- True if a hand of the specified type exists, false otherwise.
- Parameters
- LeapSide -
Look for a left or a right hand.
- OutHandId -
An integer set to the Leap Motion id of the oldest left or right hand. If no hand is found, this is set to -1.
bool GetPinchStrength(int32 HandId, float & PinchStrength)The pinch strength rating of the specified hand.
Pinch strength is a rating of whether the hand is in a pinching posture. Pinch strength starts at 0 and increases to 1 as any finger tip approaches the tip of the thumb. Note that pinch and grab strength are not independent. A grabbing hand will generally have a non-zero pinch strength as well.
- Return
- True, if the hand with the specified id exists, false otherwise.
- Parameters
- HandId -
The id of the hand of interest.
- PinchStrength -
A float set to the hand’s pinch strength as reported by Leap API
bool IsConnected()Checks whether a Leap Motion controller is connected.
- Return
- True if controller is connected, false otherwise.
bool SetHmdPolicy(bool UseHmdPolicy)Enables or disables the Leap Motion Controller policy that improves tracking for an HMD-mounted controller.
Note that calling this function does not change the transforms of any LeapMotionControllerComponent instances that may exist.
- Return
- True if the device is connected.
- Parameters
- UseHmdPolicy -
True to enable HMD-mounted mode, false to disable.
bool SetImagePolicy(bool UseImagePolicy)Enables or disables the Leap Motion Controller policy that transmits image data.
Note that setting this policy can fail if a Leap Motion device is not connected or if the user has turned off the “Allow Images” setting in their Leap Motion Control Panel (a separate program the configures the Leap Motion service).
- Return
- True if the device is connected.
- Parameters
- UseImagePolicy -
True to enable image passthrough, false to disable.