unreal.MagicLeapHandTrackingFunctionLibrary

class unreal.MagicLeapHandTrackingFunctionLibrary(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

Magic Leap Hand Tracking Function Library

C++ Source:

  • Plugin: MagicLeap

  • Module: MagicLeapHandTracking

  • File: MagicLeapHandTrackingFunctionLibrary.h

classmethod get_configuration()(active_static_gestures=Array(MagicLeapHandTrackingGesture), keypoints_filter_level=MagicLeapHandTrackingKeypointFilterLevel, gesture_filter_level=MagicLeapHandTrackingGestureFilterLevel, tracking_enabled=bool) or None

Gets the list of static and dynamic gestures currently set to be identified by the gesture recognition system.

Returns

true if the output params were populated with a valid value, false otherwise.

active_static_gestures (Array(MagicLeapHandTrackingGesture)):

keypoints_filter_level (MagicLeapHandTrackingKeypointFilterLevel): Filtering for the keypoints and hand centers.

gesture_filter_level (MagicLeapHandTrackingGestureFilterLevel): Filtering for the static gesture recognition.

tracking_enabled (bool):

Return type

tuple or None

classmethod get_current_gesture(hand)MagicLeapHandTrackingGesture or None

The current gesture being performed by the given hand.

Parameters

hand (ControllerHand) – Hand to query the gesture for. Only Left and Right hand are supported.

Returns

true if the output param was populated with a valid value, false otherwise.

gesture (MagicLeapHandTrackingGesture): Output parameter containing the given hand’s gesture, or NoHand if there isn’t one or the system isnt working now.

Return type

MagicLeapHandTrackingGesture or None

classmethod get_current_gesture_confidence(hand)float or None

The confidence level of the current gesture being performed by the given hand. Value is between [0, 1], 0 is low, 1 is high degree of confidence. For a NoHand, the confidence is always set to 1.

Parameters

hand (ControllerHand) – Hand to query the gesture confidence value for. Only Left and Right hand are supported.

Returns

true if the output param was populated with a valid value, false otherwise.

confidence (float): Output parameter containing the confidence value for the given hand’s gesture.

Return type

float or None

classmethod get_gesture_keypoint_transform(hand, keypoint, transform_space)Transform or None

Get Transform for a point on the hand.

Parameters
Returns

true if the output param was populated with a valid value, false means that is is either unchanged or populated with a stale value.

transform (Transform): Output parameter to write the data to.

Return type

Transform or None

classmethod get_gesture_keypoints(hand)Array(Transform) or None

List of keypoints detected on the given hand.

Note that this returns a transform in the Tracking space. To get the transform in Unreal’s world space, use the MotioController component as a child of the XRPawn with hand set to the following. Special_3 - Left Index Finger Tip Special_5 - Left Thumb Tip Special_4 - Right Index Finger Tip Special_6 - Right Thumb Tip

Parameters

hand (ControllerHand) – Hand to query the keypoints for. Only Left and Right hand are supported.

Returns

true if the output param was populated with a valid value, false otherwise.

keypoints (Array(Transform)): Output parameter containing transforms of the keypoints detected on the given hand.

Return type

Array(Transform) or None

classmethod get_hand_center(hand)Transform or None

Transform of the center of the hand. Approximately the center of the palm.

Note that this returns a transform in world space.

Parameters

hand (ControllerHand) – Hand to query the hand center transform for. Only Left and Right hand are supported.

Returns

true if the output param was populated with a valid value, false means that is is either unchanged or populated with a stale value.

hand_center (Transform): Output parameter containing the position and orientation of the given hand.

Return type

Transform or None

classmethod get_hand_center_normalized(hand)Vector or None

Normalized position of the center of the given hand. This can be used to detect and warn the users that the hand is out of the gesture detection frame.

Parameters

hand (ControllerHand) – Hand to query the normalized hand center position for. Only Left and Right hand are supported.

Returns

true if the output param was populated with a valid value, false otherwise.

hand_center_normalized (Vector): Output paramter containing the normalized position of the given hand.

Return type

Vector or None

classmethod get_hand_gesture_confidence(hand)

deprecated: ‘get_hand_gesture_confidence’ was renamed to ‘get_current_gesture_confidence’.

classmethod get_hand_index_finger_tip(hand, transform_space)Transform or None

Transform of the Index Finger Tip.

Parameters
  • hand (ControllerHand) – Hand to query the hand center transform for. Only Left and Right hand are supported.

  • transform_space (MagicLeapGestureTransformSpace) – Get the transform relative to the world, hand center, or tracking space.

Returns

true if the output param was populated with a valid value, false means that is is either unchanged or populated with a stale value.

pointer (Transform): Output parameter containing the position and orientation.

Return type

Transform or None

classmethod get_hand_keypoint_for_motion_source(motion_source)MagicLeapHandTrackingKeypoint or None

Get the hand tracking keypoint for a motion source.

Parameters

motion_source (Name) – The motion source to retrieve the associated keypoint for.

Returns

True if the lookup succeeded, false othewise.

out_key_point (MagicLeapHandTrackingKeypoint): The keypoint associated with the provided motion source (only valid if function returns true).

Return type

MagicLeapHandTrackingKeypoint or None

classmethod get_hand_pointer(hand, transform_space)

deprecated: ‘get_hand_pointer’ was renamed to ‘get_hand_index_finger_tip’.

classmethod get_hand_secondary(hand, transform_space)

deprecated: ‘get_hand_secondary’ was renamed to ‘get_hand_thumb_tip’.

classmethod get_hand_thumb_tip(hand, transform_space)Transform or None

Transform of Thumb Tip.

Note that this returns a transform in the Tracking space. To get the transform in Unreal’s world space, use the MotioController component as a child of the XRPawn with hand set to EControllerHand::Special_5 for the left hand secondary and EControllerHand::Special_6 for the right hand secondary.

Parameters
  • hand (ControllerHand) – Hand to query the hand center transform for. Only Left and Right hand are supported.

  • transform_space (MagicLeapGestureTransformSpace) – Get the transform relative to the world, hand center, or tracking space.

Returns

true if the output param was populated with a valid value, false means that is is either unchanged or populated with a stale value.

secondary (Transform): Output parameter containing the position and orientation.

Return type

Transform or None

Get a LiveLinkSourceHandle for magic leap hand tracking.

Returns

true if a LiveLink Source was assigned.

source_handle (LiveLinkSourceHandle): Output parameter SourceHandle that will be filled in.

Return type

LiveLinkSourceHandle or None

classmethod get_motion_source_for_hand_keypoint(hand, keypoint)Name or None

Get the motion source for a hand tracking key point.

Parameters
  • hand (ControllerHand) – The hand to retrieve the keypoint motion source for (must be Left or Right for a valid OutMotionSource value).

  • keypoint (MagicLeapHandTrackingKeypoint) – The keypoint to retrieve the motion source for.

Returns

True if the lookup succeeded, false othewise.

out_motion_source (Name): The name of the motion source associated with the provided keypoint (only valid if function returns true).

Return type

Name or None

classmethod get_static_gesture_confidence_threshold(gesture)float

Gets the minimum gesture confidence used to filter out the detected static gesture.

Parameters

gesture (MagicLeapHandTrackingGesture) – The gesture to get the confidence threshold for.

Returns

The gesture confidence threshold.

Return type

float

classmethod is_holding_control(hand)bool

Whether or not the given hand is holding a control.

Parameters

hand (ControllerHand) – Hand to query for. Only Left and Right hand are supported.

Returns

true if the hand is holding a control.

Return type

bool

classmethod set_configuration(static_gestures_to_activate, keypoints_filter_level=MagicLeapHandTrackingKeypointFilterLevel.NO_FILTER, gesture_filter_level=MagicLeapHandTrackingGestureFilterLevel.NO_FILTER, tracking_enabled=True)bool

Enables and disables the gestures to be detected by the gesture recognition system.

Parameters
Returns

true if the configuration was set successfully.

Return type

bool

classmethod set_static_gesture_confidence_threshold(gesture, confidence)None

Sets the minimum gesture confidence to filter out the detected static gesture.

Parameters