unreal.MagicLeapControllerFunctionLibrary

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

Bases: unreal.BlueprintFunctionLibrary

Magic Leap Controller Function Library

C++ Source:

  • Plugin: MagicLeap

  • Module: MagicLeapController

  • File: MagicLeapControllerFunctionLibrary.h

classmethod get_controller_mapping(controller_index) → ControllerHand or None

Returns the hand to which given controller index has been mapped to in the device backend.

The native api does not have a concept of left vs right controller. They deal with indices. The first connected controller is index 0 and so on. By default, index 0 is mapped to the right hand in Unreal. You can invert these mappings by calling InvertControllerMapping() function.

Parameters

controller_index (int32) – Zero based controller index to get the hand mapping for. Should be less than MaxSupportedMagicLeapControllers().

Returns

true of the controller index maps to a valid hand, false otherwise

hand (ControllerHand): Output parameter which is the hand the given index maps to. Valid only if the function returns true.

Return type

ControllerHand or None

classmethod get_controller_tracking_mode()MagicLeapControllerTrackingMode

Get controller tracking mode.

Returns

Controller tracking mode.

Return type

MagicLeapControllerTrackingMode

classmethod get_controller_type(motion_source)MagicLeapControllerType

Type of ML device bound to the specified motion source

Parameters

motion_source (Name) – Motion source to query.

Returns

Type of ML device which maps to given Unreal controller hand.

Return type

MagicLeapControllerType

classmethod get_hand_for_motion_source(motion_source)ControllerHand

Get motion source for hand.

Parameters

motion_source (Name) –

Returns

Hand to which motion source is mapped, ControllerHand_Count if not mapped.

Return type

ControllerHand

classmethod get_ml_controller_type(hand)MagicLeapControllerType

Type of ML device being tracking the given hand.

Parameters

hand (ControllerHand) – Controller hand to query.

Returns

Type of ML device which maps to given Unreal controller hand.

Return type

MagicLeapControllerType

classmethod get_motion_source_for_hand(hand)Name

Get motion source for hand.

Parameters

hand (ControllerHand) –

Returns

Motion source to which hand is mapped.

Return type

Name

classmethod invert_controller_mapping()None

Inverts the controller mapping i.e. keys mapped to left hand controller will now be treated as right hand and vice-versa. deprecated: Use SetMotionSourceForHand instead GetControllerMapping():

classmethod is_ml_controller_connected(motion_source)bool

Checks if the ML controller (MagicLeapControl0, MagicLeapControl1, MagicLeapMobileApp) of the given motion source is currently connected.

Parameters

motion_source (Name) – Motion source to query.

Returns

true if the ML controller of the given motion source is connected, false otherwise. Will return false if the motion source is not of an ML controller.

Return type

bool

classmethod max_supported_magic_leap_controllers() → int32

Gets the maximum number of Magic Leap controllers supported at a time. deprecated: Function ‘MaxSupportedMagicLeapControllers’ is deprecated.

Returns

the maximum number of Magic Leap controllers supported at a time.

Return type

int32

classmethod play_controller_haptic_feedback(hand, haptic_pattern, intensity)bool

Play haptic feedback on the controller. deprecated: Use PlayHapticPattern instead

Parameters
Returns

True if the command to play the haptic feedback was successfully sent to the controller, false otherwise.

Return type

bool

classmethod play_controller_led(hand, led_pattern, led_color, duration_in_sec)bool

Light up the LED on the Magic Leap Controller in the given pattern for the specified duration. deprecated: Use PlayLEDPattern instead

Parameters
Returns

True if the command to play the LED pattern was successfully sent to the controller, false otherwise.

Return type

bool

classmethod play_controller_led_effect(hand, led_effect, led_speed, led_pattern, led_color, duration_in_sec)bool

Starts a LED feedback effect using the specified pattern on the specified controller. deprecated: Use PlayLEDEffect instead

Parameters
Returns

True if the command to play the LED effect was successfully sent to the controller, false otherwise.

Return type

bool

classmethod play_haptic_pattern(motion_source, haptic_pattern, intensity)bool

Play haptic feedback on the controller.

Parameters
Returns

True if the command to play the haptic feedback was successfully sent to the controller, false otherwise.

Return type

bool

classmethod play_led_effect(motion_source, led_effect, led_speed, led_pattern, led_color, duration_in_sec)bool

Starts a LED feedback effect using the specified pattern on the specified controller.

Parameters
Returns

True if the command to play the LED effect was successfully sent to the controller, false otherwise.

Return type

bool

classmethod play_led_pattern(motion_source, led_pattern, led_color, duration_in_sec)bool

Light up the LED on the Magic Leap Controller in the given pattern for the specified duration.

Parameters
Returns

True if the command to play the LED pattern was successfully sent to the controller, false otherwise.

Return type

bool

classmethod set_controller_tracking_mode(tracking_mode)bool

Set controller tracking mode.

Parameters

tracking_mode (MagicLeapControllerTrackingMode) – Controller tracking mode. Note that this is global (it affects all control devices).

Returns

True if the command to set the tracking mode was successfully sent to the controller, false otherwise.

Return type

bool

classmethod set_motion_source_for_hand(hand, motion_source)bool

Set motion source for hand.

Parameters
Returns

True if successful, false otherwise.

Return type

bool