Spatial anchor

On this page 7

A spatial anchor is a fixed reference point in the physical world, defined by an XR system’s map of the environment, to which an application attaches virtual content so that it stays in the same real-world position and orientation. In XR development, spatial anchors are the standard mechanism for making holograms, notes or virtual furniture remain where the user placed them, even as tracking refines its understanding of the room.

Anchors solve a basic problem of inside-out tracking: the device’s coordinate system drifts and gets corrected over time. Content placed in raw world coordinates may slide away from its intended location, whereas content attached to an anchor follows the corrections of the map around it.

How a spatial anchor works

A spatial anchor works by tying a pose, meaning a position and an orientation, to distinctive visual features in the device’s environment map. The tracking system builds this map through simultaneous localization and mapping (SLAM), which detects feature points such as corners and textures and estimates the headset’s pose relative to them.

When an app creates an anchor, the system stores the pose relative to nearby features rather than to a single global origin. As SLAM corrects its map, for example after recognizing a previously visited area, it adjusts each anchor’s pose locally. Virtual objects defined relative to the anchor move with it and therefore stay aligned with the real surface.

Accuracy depends on the environment. In a well-lit room with textured surfaces, anchored content typically holds within a few centimeters near the anchor; precision declines as distance from the anchor grows, which is why large scenes use several anchors rather than one.

Types of spatial anchors

Spatial anchors differ in how long they last and who can use them. Choosing the right type determines whether content survives an app restart or can be seen by other users.

Anchor typeLifetime and scopeTypical use
Session anchorExists only while the app runsTemporary placement during one session
Persistent anchorSaved on the device and reloaded laterVirtual objects that stay in a home or office
Shared anchorShared with other devices in the same spaceCo-located multiplayer and collaboration
Cloud anchorStored on a server, resolved by other devicesCross-platform or wide-area experiences
Geospatial anchorDefined by latitude, longitude and altitudeOutdoor AR tied to real locations
Main types of spatial anchors

Persistent and shared anchors rely on the device relocalizing: when the app starts again, the system must recognize the environment, match stored features and restore the anchor’s pose. If the room has changed significantly, for instance after furniture was moved or lighting changed, relocalization may fail and the anchor cannot be found.

Spatial anchors across XR platforms

Every major XR platform offers spatial anchors, but the names, persistence rules and sharing options differ. Cross-platform standards reduce this fragmentation.

Platform or standardAnchor conceptNotes
OpenXRXrSpatialAnchor and persistence extensionsVendor-neutral API for headsets
ARKitARAnchor, world map persistenceShared sessions through collaborative maps
ARCoreAnchors, Cloud Anchors, Geospatial anchorsCloud and geospatial resolving across devices
visionOSWorld anchors managed by the systemPersistence handled by the operating system
WebXRAnchors moduleBrowser support varies by device
How major XR platforms expose spatial anchors

Engines such as Unity and Unreal wrap these APIs in anchor components, so developers can attach a game object to an anchor without handling platform details. Even so, persistence and sharing behavior still depend on the underlying platform and should be tested on each target device.

Spatial anchors are often confused with scene understanding and image or object tracking, but they solve a narrower problem: keeping a chosen pose stable. The comparison clarifies when each is appropriate.

TechniqueWhat it providesWhen to prefer it
Spatial anchorStable pose tied to the environment mapContent placed at an arbitrary spot
Scene understandingLabeled planes, meshes and objectsContent that must sit on surfaces
Image trackingPose of a known printed imageContent attached to posters or markers
Object trackingPose of a known 3D objectContent attached to machines or products
World-locked coordinatesRaw position in the tracking frameShort-lived content near the user
Spatial anchors and neighboring techniques

Best practices and common pitfalls

Reliable anchoring depends on anchor placement, anchor count and graceful handling of failures. Most anchor problems come from ignoring how tracking actually behaves.

  • Place anchors near the content: precision is highest close to the anchor, so attach each object to a nearby anchor.
  • Avoid too many anchors: each one costs memory and processing, so group objects that belong together.
  • Choose textured surroundings: blank walls, glass and mirrors give SLAM few features to track.
  • Handle tracking loss: hide or freeze content while the anchor is not located instead of showing it in the wrong place.
  • Respect privacy: shared and cloud anchors may transmit feature data describing a private space.

A common mistake is attaching an entire large scene to one anchor at the origin. Objects far from that anchor inherit its small rotation errors, which grow with distance, so a table five meters away may appear visibly misaligned. Distributing anchors across the space keeps errors local and small.

Put simply

A spatial anchor is like a pin stuck into the real world. When you place a virtual note on your kitchen wall, the headset remembers the spot by the shapes and patterns around it, and pins the note there.

The next time you look at that wall, the headset recognizes the surroundings and puts the note back exactly where you left it. Without anchors, virtual objects would slowly drift away from their places.

In practice

A furniture retailer builds a mixed reality app that lets customers place full-size virtual sofas and shelves in their living rooms. Early tests show that a sofa placed by the window creeps several centimeters toward the wall after a few minutes of walking around.

The developers attach each piece of furniture to its own spatial anchor created at the point where the customer placed it, and they save these as persistent anchors. When customers reopen the app the next day, the headset relocalizes and restores the arrangement in the same positions. Families can also join with shared anchors to view the layout together. The outcome is stable placement within a few centimeters and fewer returns caused by furniture that did not fit as expected.