Magic Leap OpenXR
The MagicLeap OpenXR plugin is required by all other plugins in the SDK that wrap OpenXR apis.
The plugin can be enabled from the plugin browser. In the Unreal editor, selected Edit -> Plugins. Enable "Magic Leap OpenXR" to enable the plugin.
The "Magic Leap" (non-OpenXR) plugin does not need to be enabled unless you are planning to use the Voice intents plugin or call legacy ML C SDK functions in your project.
Setting the reference space to use to control the level world origin
When you view your Unreal level on a Magic Leap 2 device, you will see 3d content posed in your physical space. An OpenXR reference space is used to control how the level world origin is located relative to your physical environment.
After enabling the plugin, you can set the OpenXR reference space to use to control the level world origin. See the OpenXR specification at Khronos.org for more detail on the different reference space behaviors- https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#reference-spaces
To set the reference space to use, open Edit -> Project Settings and navigate to the "Magic Leap OpenXR" page under Plugins.
The reference space used to control the world origin can be selected from the dropdown menu.
Function library
A library of static functions are provided to surface MagicLeap platform functionality exposed by several OpenXR extensions. Functions are callable from blueprints.
Include the MagicLeapOpenXRBlueprintFunctionLibrary.h header in the MagicLeapOpenXR module to call these functions in your C++ code.
Global Dimmer
https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_ML_global_dimmer
BP Accessibility | Function Signature | Description |
---|---|---|
BlueprintPure | float GetGlobalDimmerLevel() | Get global dimmer level. |
BlueprintCallable | void SetGlobalDimmerLevel(float Level) | Set global dimmer level. |
The Global Dimmer value can be set via blueprint using the Set Global Dimmer
function from the Magic Leap OpenXR Plugin.
Below is an example of setting the Global Dimmer to maximum opacity at scene start in the Level Blueprint class:
The value range for the Global Dimmer is 0-1. For more informaion about dimming priority, visit the Dimmer Feature guides.
MagicLeap Frame Info (native only)
https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_ML_frame_end_info
BP Accessibility | Function Signature | Description |
---|---|---|
BlueprintPure | float GetFocusDistance() | Get focus distance. |
BlueprintCallable | void SetFocusDistance(float FocusDistance) | Set focus distance [0-100000] cm. |
BlueprintPure | bool GetIsProtectedContent() | Get is protected content. |
BlueprintCallable | void SetIsProtectedContent(bool bIsProtectedContent) | Set is protected content. |
BlueprintPure | bool GetUseVignette() | Get use vignette. |
BlueprintCallable | void SetUseVignette(bool bUseVignette) | Set use vignette. |
View Configuration Depth Range (native only)
https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_view_configuration_depth_range
BP Accessibility | Function Signature | Description |
---|---|---|
BlueprintPure | float GetNearClipDistance() | Get near clip. |
BlueprintPure | float GetMinimumNearClipDistance() | Get minimum near clip. |
BlueprintPure | float GetRecommendedNearClipDistance() | Get recommended near clip. |
BlueprintCallable | void SetNearClipDistance(float NearClipDistance) | Set near clip. |
Physical World Occlusion (native only)
There are several occlusion modes that can be enabled to mask out regions of the MagicLeap 2 display to allow you to see physical objects in your environment, as though they were in front of the virtual objects.
Controller occlusion
BP Accessibility | Function Signature | Description |
---|---|---|
BlueprintPure | bool GetControllerOcclusionEnabled() | Check if controller occlusion is enabled |
BlueprintCallable | bool SetControllerOcclusionEnabled(bool bEnabled) | Enable controller occlusion |
Hand occlusion
BP Accessibility | Function Signature | Description |
---|---|---|
BlueprintPure | bool GetHandsOcclusionEnabled() | Check if hands occlusion is enabled |
BlueprintCallable | bool SetHandsOcclusionEnabled(bool bEnabled) | Enable hands occlusion |
Occlusion based on output from the depth sensor
BP Accessibility | Function Signature | Description |
---|---|---|
BlueprintPure | bool GetDepthSensorOcclusionEnabled() | Check if depth sensor occlusion is enabled |
BlueprintCallable | bool SetDepthSensorOcclusionEnabled(bool bEnabled) | Enable depth sensor occlusion |
BlueprintPure | float GetDepthSensorOcclusionMinNearRange() | Get depth sensor occlusion min near range |
BlueprintPure | float GetDepthSensorOcclusionMaxNearRange() | Get depth sensor occlusion max near range |
BlueprintPure | float GetDepthSensorOcclusionMinFarRange() | Get depth sensor occlusion min far range |
BlueprintPure | float GetDepthSensorOcclusionMaxFarRange() | Get depth sensor occlusion max far range |
BlueprintPure | float GetDepthSensorOcclusionNearRange() | Get depth sensor occlusion near range |
BlueprintCallable | void SetDepthSensorOcclusionNearRange(float NearRange) | Set depth occlusion near range |
BlueprintPure | float GetDepthSensorOcclusionFarRange() | Get depth sensor occlusion far range |
BlueprintCallable | void SetDepthSensorOcclusionFarRange(float FarRange) | Set depth sensor occlusion far range |
Environment occlusion
BP Accessibility | Function Signature | Description |
---|---|---|
BlueprintPure | bool GetEnvironmentOcclusionEnabled() | Check if environment occlusion is enabled |
BlueprintCallable | bool SetEnvironmentOcclusionEnabled(bool bEnabled) | Enable environment occlusion |