LibraryWhat are Anchors?

What are Anchors?

Learn about What are Anchors? as part of AR/VR Development with Unity XR

Understanding Anchors in Extended Reality

In Extended Reality (XR), particularly within Augmented Reality (AR) and Virtual Reality (VR) development, anchors are fundamental concepts. They provide a stable reference point in the real or virtual world, allowing digital content to be persistently placed and tracked.

What is an Anchor?

An anchor is essentially a marker in the XR environment that represents a specific real-world location or a point in virtual space. When you place a virtual object in AR, for instance, you associate it with an anchor. This anchor then tells the XR system where to keep that object relative to the real world as the user moves their device.

Anchors provide persistent spatial references for virtual content.

Think of anchors as virtual 'pins' that hold digital objects in place within the real world. Without them, virtual objects would drift and lose their position as you move your device.

Anchors are crucial for creating immersive and believable XR experiences. They enable features like placing virtual furniture in your living room, having a virtual character interact with your physical environment, or creating persistent multiplayer AR games where players see the same virtual objects in the same real-world locations. The XR system continuously updates the anchor's position and orientation based on sensor data (like camera feeds and IMUs) to maintain this spatial relationship.

Types of Anchors

XR platforms typically support different types of anchors, each suited for specific use cases:

Anchor TypeDescriptionUse Case Example
World AnchorsReference points tied to the physical world's coordinate system. They remain fixed in real space.Placing a virtual painting on a real wall.
Scene AnchorsReference points within a specific virtual scene or session. They might not be tied to the physical world directly but are stable within the virtual environment.Maintaining the position of a virtual character in a VR game.
Object AnchorsAnchors specifically associated with detected real-world objects (e.g., a specific chair or table).Attaching a virtual label to a recognized piece of furniture.

How Anchors Work (Conceptual)

The XR system uses various techniques to create and maintain anchors. This often involves feature detection and tracking. The system identifies distinctive visual features in the environment (like corners, textures, or unique patterns) and uses them to build a map of the surroundings. When an anchor is created, the system associates it with a set of these features. As the user moves, the system re-identifies these features and uses them to calculate the anchor's current position and orientation relative to the device's camera and sensors. This process is often referred to as Simultaneous Localization and Mapping (SLAM).

📚

Text-based content

Library pages focus on text content

Anchors are the backbone of persistent AR experiences, ensuring virtual content stays 'stuck' to the real world.

Key Benefits of Using Anchors

Utilizing anchors in XR development offers several advantages:

  • Persistence: Virtual content remains in its designated place across sessions and user movements.
  • Stability: Digital objects appear stable and don't jitter or drift unnaturally.
  • Interactivity: Enables realistic interactions between virtual objects and the real environment.
  • Collaboration: Allows multiple users to see and interact with the same virtual content in shared physical spaces.
What is the primary function of an anchor in XR development?

To provide a stable, persistent reference point in the real or virtual world for digital content.

Anchors in Unity XR

In Unity, the XR Interaction Toolkit and AR Foundation package provide robust systems for managing anchors. You'll typically work with components like

code
ARAnchorManager
and
code
ARAnchor
to create, manage, and attach virtual content to these spatial references.

Learning Resources

AR Foundation: Anchors(documentation)

Official Unity documentation explaining how to use anchors with the AR Foundation package, covering creation and management.

Understanding AR Anchors(blog)

A detailed explanation of AR anchors, their purpose, and how they contribute to persistent AR experiences from Vuforia.

Introduction to ARKit Anchors(documentation)

Apple's developer documentation on how ARKit anchors work and are integrated into Unity projects.

Spatial Anchors Explained(documentation)

Microsoft's overview of Azure Spatial Anchors, a cloud-based service for creating shared, persistent AR experiences across devices.

ARCore Anchors(documentation)

Google's developer guide to ARCore anchors, explaining how to create and manage them for Android AR applications.

Persistent AR Experiences with Unity and AR Foundation(video)

A YouTube tutorial demonstrating how to implement persistent AR experiences using Unity and AR Foundation, focusing on anchors.

What are Spatial Anchors?(video)

A conceptual video explaining the importance and functionality of spatial anchors in the context of AR and VR.

Unity XR Interaction Toolkit: Anchors(documentation)

Unity's official documentation for the XR Interaction Toolkit, detailing how anchors are used within its framework.

Understanding SLAM in Augmented Reality(video)

An educational video explaining the Simultaneous Localization and Mapping (SLAM) technology that underpins AR anchor tracking.

AR Foundation Tutorials - Anchors(tutorial)

A learning path on Unity Learn that includes tutorials specifically covering anchors and their implementation in AR Foundation.