Skip to content

How Spatial Anchors Work in AR Glasses and Headsets

By AR Compare Team ·

A spatial anchor is a saved spot in the real world, with a position and a direction, that virtual content is attached to. AR headsets and glasses build a map of the room as you move, and that map keeps getting corrected. An anchor moves with those corrections, so a virtual screen on your wall or a note on your desk stays in the same real place instead of slowly sliding away. Anchors can be kept only for the current session, saved on the device for later, or shared online so other people see the same object in the same spot.

This explainer is based on Google’s ARCore guides to anchors and Cloud Anchors, and Android’s anchor guide for Android XR, which covers headsets and wired XR glasses. If you build AR apps, see AR glasses for developers.

Why objects drift without anchors

An AR device works out where it is by tracking distinct points in its camera images and combining them with its motion sensors, a process called SLAM. See how 6DoF tracking works for that part. The result is a running estimate of the room, called world space.

That estimate is never final. As the device sees more of the room, it corrects earlier guesses. Google’s guide explains the side effect: as ARCore’s understanding updates, virtual objects can appear to drift away from where they were placed. An object placed at fixed coordinates stays at those coordinates even after the device decides the coordinates themselves were slightly wrong.

An anchor solves this by tying the object to the real world, not to the numbers. Each frame, the anchor’s position is updated with the latest estimate, and anything attached to it moves along.

How an anchor works

Google describes it in 3 steps:

  1. Pick a pose. A pose is a position plus an orientation. Apps often get one by pointing at a surface, for example where a tap on the screen meets a detected table.
  2. Create the anchor at that pose.
  3. Attach content. One or more virtual objects are tied to the anchor and inherit its updates.

Android’s guide adds a practical benefit: once content is anchored, the app does not need to run its own logic every frame to keep it in place, which saves power.

Anchoring to a surface or to space

There are 2 ways to attach an anchor.

  • To something the device tracks, such as a detected plane. Google says content attached this way appears welded to that surface. If the device later refines where the table is, the object stays on the table. See how plane detection works.
  • To a fixed point in space. Android’s guide recommends this only for content floating in the air, because the device’s estimate of where solid objects are will change over time.

Rules of thumb from Google

  • Share anchors between nearby objects. If 2 lamps sit on 1 table, attach both to 1 anchor. Google warns that objects with separate anchors can shift relative to each other.
  • Stay close. Keep objects within 8 meters (26 feet) of their anchor. Farther than that, small rotation errors can swing the object noticeably, so Google suggests making a new anchor near it.
  • Clean up. Each anchor costs processing. Detach anchors you no longer need.

How long anchors last

Google sorts anchors by how widely they are valid.

Anchor typeStoredWho can use it
LocalWith the appThat app session
Persistent (Android XR)In the app’s private dataThe same app in a later session
CloudOn Google’s serversOther users and devices
GeospatialBy latitude, longitude and altitudeAnyone with the app, in places Google’s positioning covers

Persistent anchors. Android XR turns persistence off by default. When an app enables it, an anchor is saved with an ID and can be loaded in a later session in the same real location. That lets an app put content back where you left it.

Cloud anchors. To host one, the device’s camera maps the area around the anchor from different angles. Google’s service builds a 3D map of visual features and returns an ID. When another device in the same place resolves that ID, the service compares what its camera sees with the stored map to work out where it is relative to the anchor. Google says this works across Android and iPhone, needs an internet connection, suits room-scale experiences, and lets people return to content weeks or months later.

Geospatial anchors use location plus Google’s visual positioning data, so an app can place them from a remote location, as Google notes, and people find them on site. See how visual positioning works.

What this means for glasses you can buy

Anchors depend on the device knowing where it is in the room, not just which way your head is turned. Display glasses that track only rotation can keep a virtual screen in front of you, but they cannot leave an object on your table while you walk around it. For that you need glasses or a headset with 6DoF tracking and a platform with anchor support. Compare 3DoF and 6DoF glasses, and see AR headsets for work.

For the term itself, see the spatial anchor glossary entry. For headsets and glasses that place apps around you, browse XR glasses.

Frequently asked questions

What is a spatial anchor?

A saved position and direction in the real world that virtual content can be attached to. The device keeps updating where that spot is, so the content stays put as you move.

Why do virtual objects drift in AR?

The device's map of the room keeps improving as it sees more. Without an anchor, an object placed on the old estimate can appear to slide when the estimate changes. An anchor moves with the corrected map.

Can spatial anchors be saved and reopened later?

Yes, on platforms that support it. Android XR can store anchors in the app's private data and load them in a later session. Google's Cloud Anchors store them online, and Google says people can return to them weeks or months later.

Can 2 people see the same anchored object?

Yes, with a shared anchor. ARCore's Cloud Anchors let one device host an anchor and others resolve it by ID, on both Android and iPhone.

Do simple display glasses use spatial anchors?

Not in this sense. Glasses that only track head rotation can pin a screen in front of you, but placing objects on a table and leaving them there needs 6DoF tracking and a map of the room.