engine.leap_motion Functions
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
This set of functions is available when the LeapMotion plugin is loaded.
If the plugin is loaded together with the engine, the HAS_LEAP_MOTION definition is set. This definition can be used, for example, to avoid errors if the plugin is not loaded: the code in which the plugin functions are executed can be wrapped around as follows:
#ifdef HAS_LEAP_MOTION
// engine.leap_motion functions
#endif
LeapMotion Class
Members
bool engine.leap_motion.isConnected ( ) #
Returns a value indicating if the LeapMotion device is connected.Return value
true if the LeapMotion device is connected; otherwise, false.bool engine.leap_motion.isServiceConnected ( ) #
Returns a value indicating if your application has a connection to the Leap Motion daemon/service.Can return true even if the Leap Motion hardware is not available. To check if the hardware is connected, use the isConnected() method.
Return value
true if your application has a connection to the Leap Motion daemon/service; otherwise, false.bool engine.leap_motion.isSmudged ( ) #
Returns a value indicating if a possible smudge on the translucent cover over the Leap Motion cameras was detected.Return value
true if a possible smudge on the translucent cover over the Leap Motion cameras was detected; otherwise, false.bool engine.leap_motion.isLightingBad ( ) #
Returns a value indicating if the excessive IR illumination was detected.Return value
true if the excessive IR illumination was detected; otherwise, false.bool engine.leap_motion.hasFocus ( ) #
Returns a value indicating if the application is the focused (foreground) application.By default, your application only receives tracking information from the Leap Motion controller when it has the operating system input focus. To receive tracking data when your application is in the background, the background frames policy flag must be set.
Return value
true if the application is the focused (foreground) application; otherwise, false.void engine.leap_motion.setPolicy ( int policy ) #
Requests setting the specified policy. A request to change a policy is subject to user approval and a policy can be changed by the user at any time (using the Leap Motion settings dialog).The desired policy flags must be set every time an application runs.
Arguments
- int policy - Policy. One of the LEAP_MOTION_POLICY_* values.
bool engine.leap_motion.isPolicySet ( int policy ) #
Returns a value indicating if the specified policy is set. To set a policy use the setPolicy() method.Arguments
- int policy - Policy type. One of the LEAP_MOTION_POLICY_* values.
Return value
true if the specified policy is set; otherwise, false.void engine.leap_motion.clearPolicy ( int policy ) #
Requests clearing the specified policy. A request to change a policy is subject to user approval and a policy can be changed by the user at any time (using the Leap Motion settings dialog).The required policy flags must be set every time an application runs.
Arguments
- int policy - Policy. One of the LEAP_MOTION_POLICY_* values.
void engine.leap_motion.setPaused ( bool pause ) #
Pauses or resumes the Leap Motion service.Arguments
- bool pause - true - to pause the Leap Motion service; false - to resume it.
bool engine.leap_motion.isPaused ( ) #
Returns a value indicating if the Leap Motion service is currently paused.Return value
true if the Leap Motion service is currently paused; otherwise, false.float engine.leap_motion.getHorizontalViewAngle ( ) #
Returns the angle of view along the X axis (long dimension) of the Leap Motion device. The Leap Motion controller scans a region in the shape of an inverted pyramid centered at the device’s center and extending upwards.Return value
Angle of view along the X axis of the Leap Motion device, in degrees.float engine.leap_motion.getVerticalViewAngle ( ) #
Returns the angle of view along the Z axis (short dimension) of the Leap Motion device. The Leap Motion controller scans a region in the shape of an inverted pyramid centered at the device’s center and extending upwards.Return value
Angle of view along the Z axis of the Leap Motion device, in degrees.float engine.leap_motion.getRange ( ) #
Returns the maximum recommended distance from the device center for which tracking is expected to be reliable.This distance is not a hard limit. Tracking may be still be functional above this distance or begin to degrade slightly before this distance depending on calibration and extreme environmental conditions.
Return value
Maximum reliable tracking range from the center of this device, in meters.float engine.leap_motion.getBaseline ( ) #
Returns the distance between the center points of the stereo cameras of the Leap Motion device.Return value
Distance between the center points of the stereo cameras of the Leap Motion device, in meters.float engine.leap_motion.getFPS ( ) #
Returns the current framerate.Return value
Current framerate.float engine.leap_motion.getDistanceToBoundary ( vec3 position ) #
Returns the distance from the specified point to the nearest edge of the Leap Motion controller's view volume. The view volume is an axis-aligned, inverted pyramid centered on the device origin and extending upward to the range limit. The walls of the pyramid are described by the horizontalViewAngle and verticalViewAngle and the roof by the range.Arguments
- vec3 position - Point to measure the distance from.
Return value
Distance from the specified point to the nearest edge of the Leap Motion controller’s view volume, in meters.const Vector< Ptr<Image> > & engine.leap_motion.getImages ( ) #
Returns the list of the most recent images from the infrared stereo cameras of the device. Images are in the Image::FORMAT_R8. The images can be used for:- Head-mounted display video pass-through
- Augmented reality
- Computer vision
Return value
Vector containing images from the cameras.Ptr<Image> & engine.leap_motion.getImage ( int num ) #
Returns the selected image from the list of the most recent images from the infrared stereo cameras of the device. Images are in the Image::FORMAT_R8.Arguments
- int num - Index number of the image in the array.
Return value
Selected image from the cameras.int engine.leap_motion.getNumHands ( ) #
Returns the number of currently tracked hands.Return value
Number of currently tracked hands.engine.leap_motion.getHands ( ) #
Returns the list of currently tracked hands.Return value
List of currently tracked hands.Hand engine.leap_motion.getHandById ( int id ) #
Returns a hand with the specified ID.Arguments
- int id - ID of a hand to be found.
Return value
Hand with the specified ID.Hand engine.leap_motion.getHandByIndex ( int index ) #
Returns a hand with the specified index.Arguments
- int index - Index of a hand to be found.
Return value
Hand with the specified index.Arm engine.leap_motion.getArmFromHand ( Hand hand ) #
Returns the arm for the specified hand.Arguments
- Hand hand - Hand to find the arm for.
Return value
Arm for the specified hand.int engine.leap_motion.getNumFingersFromHand ( Hand hand ) #
Returns the number of fingers for the specified hand.Arguments
- Hand hand - Hand to find the number of fingers for.
Return value
Number of fingers for the specified hand.Finger engine.leap_motion.getFingerFromHandById ( Hand hand, int id ) #
Returns a finger with the specified ID belonging to the specified hand.Arguments
- Hand hand - Hand to find a finger for.
- int id - ID of a finger to be found.
Finger IDs are assigned based on the hand ID. If a hand has an ID of “5”, then its fingers are assigned IDs 50 to 55, ordered from thumb to pinky.
Return value
Finger with the specified ID belonging to the specified hand.Finger engine.leap_motion.getFingerFromHandByIndex ( Hand hand, int index ) #
Returns a finger with the specified index belonging to the specified hand.Arguments
- Hand hand - Hand to find a finger for.
- int index - Index of a finger to be found.
Return value
Finger with the specified index belonging to the specified hand.Bone engine.leap_motion.getBoneFromFinger ( int finger, int index ) #
Returns a bone with the specified index belonging to the specified finger.Arguments
- int finger - Finger to find a bone for.
- int index - Index of a bone to be found.
Return value
Bone with the specified index belonging to the specified finger.Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)