Skip to main content
Version: 20 Mar 2024

MagicLeapSpatialAnchorsStorageFeature

NameSpace: MagicLeapSupport

Inherits from:
MagicLeapOpenXRFeatureBase,
OpenXRFeature

Public Methods

bool CreateSpatialAnchorsFromStorage

public bool CreateSpatialAnchorsFromStorage(
List< String > AnchorMapPositionIds
)

Parameters

TypeNameDescription
List< String >AnchorMapPositionIds

bool DeleteStoredSpatialAnchor

Delete published anchors from Spatial Anchor Storage.

public bool DeleteStoredSpatialAnchor(
List< string > AnchorMapPositionIds
)

Parameters

TypeNameDescription
List< string >AnchorMapPositionIdsThe list of AnchorMapPositionIds to Delete. These were assigned in the OnPublishComplete event in MagicLeapSpatialAnchorsStorageFeature.

delegate void OnCreationCompleteFromStorageEvent

public delegate void OnCreationCompleteFromStorageEvent(
Pose pose,
ulong anchorId,
string anchorStorageId,
XrResult result
)

Parameters

TypeNameDescription
Posepose
ulonganchorId
stringanchorStorageId
XrResultresult

delegate void OnDeletedCompleteEvent

public delegate void OnDeletedCompleteEvent(
List< string > anchorMapPositionId
)

Parameters

TypeNameDescription
List< string >anchorMapPositionId

delegate void OnPublishCompleteEvent

public delegate void OnPublishCompleteEvent(
ulong anchorId,
string anchorMapPositionId
)

Parameters

TypeNameDescription
ulonganchorId
stringanchorMapPositionId

delegate void OnQueryCompleteEvent

public delegate void OnQueryCompleteEvent(
List< string > anchorMapPositionId
)

Parameters

TypeNameDescription
List< string >anchorMapPositionId

delegate void OnUpdateExpirationCompleteEvent

public delegate void OnUpdateExpirationCompleteEvent(
List< string > anchorMapPositionId
)

Parameters

TypeNameDescription
List< string >anchorMapPositionId

bool PublishSpatialAnchorsToStorage

Publish local anchors to Spatial Anchor Storage using the MagicLeap Anchor Id.

public bool PublishSpatialAnchorsToStorage(
List< ulong > AnchorIds,
ulong expiration
)

Parameters

TypeNameDescription
List< ulong >AnchorIdsThe list of AnchorIds to publish. These were assigned in the OnCreationComplete event in MagicLeapSpatialAnchorsFeature.
ulongexpirationThe time in seconds since epoch after which these anchors may: expire. Use 0 for permanent anchors. The system may retain them longer.

bool PublishSpatialAnchorsToStorage

Publish local anchors to Spatial Anchor Storage using ARAnchors. Will return false if XRAnchorSubsystem is not loaded.

public bool PublishSpatialAnchorsToStorage(
List< ARAnchor > Anchors,
ulong expiration
)

Parameters

TypeNameDescription
List< ARAnchor >AnchorsThe list of ARAnchors to publish. TrackingState must be Tracking to be valid for publish. Will be ignored if not.
ulongexpirationThe time in seconds since epoch after which these anchors may: expire. Use 0 for permanent anchors. The system may retain them longer.

bool QueryStoredSpatialAnchors

Determine the maximum number of anchors to accept their completion status each update.

public bool QueryStoredSpatialAnchors(
Vector3 position,
float radius
)

Parameters

TypeNameDescription
Vector3positionThe position of the center of the query
floatradiusThe radius of the search area in meters.

bool UpdateExpirationonStoredSpatialAnchor

Update the exiration time for published anchors in Spatial Anchor Storage.

public bool UpdateExpirationonStoredSpatialAnchor(
List< string > AnchorMapPositionIds,
ulong expiration
)

Parameters

TypeNameDescription
List< string >AnchorMapPositionIdsThe list of AnchorMapPositionIds to Delete. These were assigned in the OnPublishComplete event in MagicLeapSpatialAnchorsStorageFeature.
ulongexpirationThe time in seconds since epoch after which these anchors may: expire. The system may retain them longer.

Protected Methods

OnInstanceCreate

protected override bool OnInstanceCreate(
ulong xrInstance
)

Parameters

TypeNameDescription
ulongxrInstance

OnInstanceDestroy

protected override void OnInstanceDestroy(
ulong xrInstance
)

Parameters

TypeNameDescription
ulongxrInstance

Public Attributes

ExtensionName


public const string ExtensionName = "XR_ML_spatial_anchors_storage XR_EXT_future";


FeatureId


public const string FeatureId = "com.magicleap.openxr.feature.ml2_spatialanchorstorage";


Public Events

OnCreationCompleteFromStorage

public OnCreationCompleteFromStorageEvent OnCreationCompleteFromStorage()

OnDeletedComplete

public OnDeletedCompleteEvent OnDeletedComplete()

OnPublishComplete

public OnPublishCompleteEvent OnPublishComplete()

OnQueryComplete

public OnQueryCompleteEvent OnQueryComplete()

OnUpdateExpirationCompleted

public OnUpdateExpirationCompleteEvent OnUpdateExpirationCompleted()