Skip to main content
Version: 21 Aug 2024

MagicLeapController

NameSpace: Examples

Convenient utility for accessing InputActions bound to the ML2 controller's OpenXR action paths

Public Fields

BumperPressed

Bumper press event


public Action< InputAction.CallbackContext > BumperPressed { get; set; }


Instance

Singleton instance of the ML2 Controller action map bindings


public static MagicLeapController Instance { get; set; }

TypeDescription
MagicLeapControllerConvenient utility for accessing InputActions bound to the ML2 controller's OpenXR action paths

MenuPressed

Menu button press event


public Action< InputAction.CallbackContext > MenuPressed { get; set; }


TrackpadClicked

Trackpad click event


public Action< InputAction.CallbackContext > TrackpadClicked { get; set; }


TriggerPressed

Trigger press event


public Action< InputAction.CallbackContext > TriggerPressed { get; set; }


Public Attributes

AngularVelocity

The current angular velocity of the controller.


public Vector3 AngularVelocity => angularVelocityAction.ReadValue<Vector3>();


BumperIsPressed

Is the controller's bumper currently pressed?


public bool BumperIsPressed => bumperAction.IsPressed();


IsTracked

Is the controller currently being tracked?


public bool IsTracked => isTrackedAction.IsPressed();


MenuIsPressed

Is the controller's menu button currently pressed?


public bool MenuIsPressed => menuButtonAction.IsPressed();


PointerPosition

The world position of the controller's pointer raycast origin.


public Vector3 PointerPosition => pointerPositionAction.ReadValue<Vector3>();


PointerRotation

The world rotation of the controller's pointer raycast origin.


public Quaternion PointerRotation => pointerRotationAction.ReadValue<Quaternion>();


Position

The world position of the controller body where the user should be holding it.


public Vector3 Position => positionAction.ReadValue<Vector3>();


Rotation

The world rotation of the controller body where the user should be holding it.


public Quaternion Rotation => rotationAction.ReadValue<Quaternion>();


TouchPosition

The position on the controller's touchpad that is currently touched.


public Vector2 TouchPosition => trackpadAction.ReadValue<Vector2>();


TouchPressure

The current touch pressure being applied to the controller's touchpad, from 0 to 1.


public float TouchPressure => trackpadForceAction.ReadValue<float>();


TrackingState

The current InputTrackingState of the controller.


public InputTrackingState TrackingState => (InputTrackingState)trackingStatusAction.ReadValue<int>();


TriggerIsPressed

Is the controller's trigger button currently pressed?


public bool TriggerIsPressed => triggerAction.IsPressed();


TriggerValue

The current analog value of the controller's trigger, from 0 to 1.


public float TriggerValue => triggerValueAction.ReadValue<float>();


Velocity

The current movement velocity of the controller.


public Vector3 Velocity => velocityAction.ReadValue<Vector3>();