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 type | Lifetime and scope | Typical use |
|---|---|---|
| Session anchor | Exists only while the app runs | Temporary placement during one session |
| Persistent anchor | Saved on the device and reloaded later | Virtual objects that stay in a home or office |
| Shared anchor | Shared with other devices in the same space | Co-located multiplayer and collaboration |
| Cloud anchor | Stored on a server, resolved by other devices | Cross-platform or wide-area experiences |
| Geospatial anchor | Defined by latitude, longitude and altitude | Outdoor AR tied to real locations |
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 standard | Anchor concept | Notes |
|---|---|---|
| OpenXR | XrSpatialAnchor and persistence extensions | Vendor-neutral API for headsets |
| ARKit | ARAnchor, world map persistence | Shared sessions through collaborative maps |
| ARCore | Anchors, Cloud Anchors, Geospatial anchors | Cloud and geospatial resolving across devices |
| visionOS | World anchors managed by the system | Persistence handled by the operating system |
| WebXR | Anchors module | Browser support varies by device |
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 compared with related concepts
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.
| Technique | What it provides | When to prefer it |
|---|---|---|
| Spatial anchor | Stable pose tied to the environment map | Content placed at an arbitrary spot |
| Scene understanding | Labeled planes, meshes and objects | Content that must sit on surfaces |
| Image tracking | Pose of a known printed image | Content attached to posters or markers |
| Object tracking | Pose of a known 3D object | Content attached to machines or products |
| World-locked coordinates | Raw position in the tracking frame | Short-lived content near the user |
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.