Skip to main content
Version: 21 Aug 2024

MLAnchors

NameSpace: MagicLeap

Spatial Anchor management is closely tied to the selected mapping mode on the device. The modes are mutually exclusive and affect the functionality of these APIs. The available mapping modes are: More...

Inherits from:
MLAutoAPISingleton< MLAnchors >,
MLLazySingleton< T >

Detailed Description

public class MLAnchors : MLAutoAPISingleton< MLAnchors > 

Details*

Spatial Anchor management is closely tied to the selected mapping mode on the device. The modes are mutually exclusive and affect the functionality of these APIs.For example, publishing an anchor is not available in "per-session" mapping mode.The available mapping modes are: Per-Session Mode - A non-persistent mode in which anchors are only available for the currently active tracking session. On-Device Mode - A persistent mode in which anchors are persisted locally and will be available in multiple sessions when localized to the same space in which they were published.

On-Device Mode - A persistent mode in which anchors are persisted locally and will be available in multiple sessions when localized to the same space in which they were published.

AR Cloud Mode - A persistent mode in which anchors are persisted in the cloud environment and will be available in multiple sessions to devices that are localized to the same space in which they were published.


Public Methods

MLResult GetLocalizationInfo

public static MLResult GetLocalizationInfo(
out LocalizationInfo info
)

Parameters

TypeNameDescription
out LocalizationInfoinfoA structure containing information about the device's localization state.

Protected Methods

StartAPI

Do API-specific creation/initialization of ML resources for this API, such as creating trackers, etc. Called automatically the first time Instance is accessed. Error checking on the return value is performed in the base class.

protected virtual override MLResult.Code StartAPI()

Reimplements: StartAPI


StopAPI

API-specific cleanup. Will be called whenever MLDevice is destroyed (at the latest, when the application is shutting down). Error checking on the return value is performed in the base class.

protected virtual override MLResult.Code StopAPI()

Reimplements: StopAPI


Public Attributes

MaxSpaceNameLength

Maximum size for the name of the space in the #MLSpatialAnchorLocalizationInfo structure.


public const uint MaxSpaceNameLength = 64;


Public Enums

LocalizationStatus

LocalizationStatus

EnumeratorValueDescription
NotLocalizedThe device is not currently localized.
LocalizedThe device has localized successfully.
LocalizationPendingA localization attempt is currently in progress.
LocalizationFailedThe last localization attempt failed.

MappingMode

The current mapping mode, set via settings.

EnumeratorValueDescription
OnDeviceUsing on-device mapping .
ARCloudUsing cloud-based mapping.

Quality

The quality of the local space around the anchor. This can change over time as the user continues to scan the space.

EnumeratorValueDescription
LowLow quality, this anchor can be expected to move significantly.
MediumMedium quality, this anchor may move slightly.
HighHigh quality, this anchor is stable and suitable for digital content attachment.