Skip to main content
Version: 20 Mar 2024

MLSpatialAnchor

Module: Magic Leap Spaces / Spatial Anchor

A structure representing a user-defined Spatial Anchor. More...

#include <ml_spatial_anchor.h>

Public Attributes

TypeName
uint32_tversion
Version of the structure.
MLUUIDid
The anchor's unique ID.
MLCoordinateFrameUIDcfuid
The coordinate frame identifier of the Spatial Anchor.
uint64_texpiration_timestamp_s
The suggested expiration timestamp for this anchor represented in seconds since the Unix epoch.
boolis_persisted
Indicates whether or not the anchor has been persisted via a call to MLSpatialAnchorPublish.
MLUUIDspace_id
The ID of the space that this anchor belongs to. This is only relevant if is_persisted is true.
MLSpatialAnchorQualityquality
The quality of the local space that this anchor occupies. This value may change over time.

Detailed Description

struct MLSpatialAnchor;

A structure representing a user-defined Spatial Anchor.

API Level:

  • 31

Public Attributes Documentation

version

uint32_t version;

Version of the structure.


id

MLUUID id;

The anchor's unique ID.

This is a unique identifier for a single Spatial Anchor that is generated and managed by the Spatial Anchor system. The ID is created when MLSpatialAnchorCreate is called.


cfuid

MLCoordinateFrameUID cfuid;

The coordinate frame identifier of the Spatial Anchor.

This should be passed to MLSnapshotGetTransform to get the anchor's transform.

The anchor's transform is set when the anchor is created but may be updated later by the Spatial Anchor system based on factors such as quality of the mapped space and subsequent localizations.


expiration_timestamp_s

uint64_t expiration_timestamp_s;

The suggested expiration timestamp for this anchor represented in seconds since the Unix epoch.

This is implemented as an expiration timestamp in the future after which the associated anchor should be considered no longer valid and may be removed by the Spatial Anchor system.


is_persisted

bool is_persisted;

Indicates whether or not the anchor has been persisted via a call to MLSpatialAnchorPublish.


space_id

MLUUID space_id;

The ID of the space that this anchor belongs to. This is only relevant if is_persisted is true.


quality

MLSpatialAnchorQuality quality;

The quality of the local space that this anchor occupies. This value may change over time.

TypeDescription
MLSpatialAnchorQualityThe quality of the local space around the anchor.