🕶️
NRSDK(Old)
New DocumentationSDK DownloadAPI Reference
v2.2.1
v2.2.1
  • NRSDK Fundamentals
    • NRSDK Overview
    • XREAL Devices
      • XREAL Glasses
      • Controller
      • Compatibility
    • Getting Started with NRSDK
    • Sample Code
    • Tutorials
    • Release Note
      • NRSDK 2.2.1
      • NRSDK 2.2.0
      • NRSDK 2.1.1
      • NRSDK 2.1.0
      • NRSDK 1.10.2
      • NRSDK 1.9.5
      • NRSDK 1.9.3
      • NRSDK 1.9.1
      • NRSDK 1.8.0
      • NRSDK 1.7.0
      • NRSDK 1.6.0
  • Development
    • Input and Camera
      • NRInput
      • Interact with Unity UI (Tutorial)
      • Customize Controller UI
      • NRCameraRig
    • Hand Tracking
    • Image Tracking
      • XREAL Markers
    • Plane Detection (Tutorial)
      • Overview
      • Import the package
      • Detect planes in the real world
      • Perform a hit test against detected planes
      • Add a car
      • Add gems
      • Wrap up
    • Depth Mesh
      • Meshing Manager Overview
      • Use Meshes in the Editor
      • Tutorial: Mesh Collision
    • Spatial Anchor
      • Mapping Example Scene
      • Tutorial: Halloween Treasure Hunt
        • Handle the Situation of Failed Anchor Saving
      • Tutorial: Sharing Anchors
        • Setting Up Photon
        • Cloud Storage: Firebase (optional)
        • Cloud Storage: Aliyun OSS (optional)
        • Implementing Cloud Save and Load
        • Sharing Anchors with Photon
    • Tools
      • Single Pass Stereo Rendering
      • First Person View
      • Emulator
      • XR Streaming
      • Dual Screen Display
    • Miscellaneous
      • Access RGB Camera
      • NRSDK Coordinate Systems
      • MRTK2 Integration
      • MRTK3 Integration
      • Notification popup
      • Reset Camera
      • Render Metrics
      • Render MonoMode(Obsolete)
  • API Reference
  • Frequently Asked Questions
  • Design Guide
    • Design Guide Overview
    • Displaying
    • Interacting
    • Controlling
    • Navigating
Powered by GitBook
On this page
  • Introduction
  • Main Features
  • Installation and Configuration
  • Best Practice

Was this helpful?

  1. Development

Spatial Anchor

PreviousTutorial: Mesh CollisionNextMapping Example Scene

Last updated 1 year ago

Was this helpful?

Introduction

Spatial Anchors are world-locked reference points in the AR environment that can be used to position and persist content across multiple sessions. By creating a spatial anchor at a specific 6DOF pose (position and orientation), virtual content can be placed relative to it. This allows for the resumption of AR sessions and the restoration of content to the exact real-world locations where users left them. This plays a crucial role in providing users with a consistent and reliable AR experience, as they can see the persistently present virtual content at the same location, no matter when they return or restart the application. The NRSDK provides Spatial Anchor functionality for XREAL glasses, enabling developers to easily create and manage spatial anchors in their Unity projects.

Main Features

  • Easily create and manage spatial anchors in Unity

  • Save and load spatial anchors

  • Support user interactions, such as clicking on spatial anchors

  • Show mapping quality during spatial anchor creation.

Installation and Configuration

Please follow these steps to import the SDK into your Unity project:

  1. Download and import the SDK package.

  2. Add the AnchorItem script to the game object you want to use as an anchor.

  3. Set the properties of AnchorItem in the Unity Inspector.

  1. Inspect Mapping Example scene and LocalMapExample.cs as reference for an implementation of spatial anchor.

Best Practice

  1. After adding a spatial anchor, it is essential to observe the surrounding environment thoroughly, with the spatial anchor as the focal point. This procedure ensures that the added anchor can be reliably located in multiple sessions.

    1. Characteristics of a high-quality observation environment include:

      1. Adopting the anchor as the observational center and moving in various directions, such as forward, backward, left, and right, to ensure an ample observational perspective.

      2. Maintaining smooth and slow movement.

      3. Allotting an observation time between 5 and 15 seconds.

    2. Factors that can degrade the quality of the observation environment:

      1. Rapidly changing the viewpoint after adding the anchor, causing the anchor to leave the field of vision.

      2. Quick movements or turning of the head.

      3. Saving the anchor immediately after adding it, without adequately observing the environment.

    3. Elements of a high-quality visual environment are:

      1. Even lighting.

      2. Rich textural detail.

      3. Appropriate distance between 0.5 and 3 meters.

    4. Characteristics of a low-quality visual environment include:

      1. Poor lighting conditions.

      2. Transparent, semi-transparent, or reflective surfaces.

      3. Absence of texture, such as white walls.

  2. Avoid attaching object to spatial anchors that are more than 3 meters away. Please create a new spatial anchor for the attachment of object. Any inaccuracies in the pose are magnified when an object is distanced from the spatial anchor.

  3. Utilize parent-child relationships to create a transformation hierarchy between the tightly arranged virtual object and their corresponding spatial anchors. This helps to maintain consistent relative positioning of the virtual object.

  4. To optimize system performance, destroy unused spatial anchors and only load the spatial anchors that are needed.

AnchorItem