Spatial Anchors Overview
Spatial anchors are world-locked frames of reference that you can use to position
content. They are transforms that represent fixed physical locations in the real
world.
You can use spatial anchors to enrich the user experience in many ways, such as
placing virtual signs on real furniture or creating spawn points on real
windows for virtual characters to fly through.
Creating a New Spatial Anchor
Spatial Anchors are Most Effective within 3 Meters
Create a spatial anchor within 3 meters of the object you want to anchor. Otherwise, your pose will be incorrect due to drift (that is, even though the location of the spatial anchor remains the same, the farther the user moves away from the spatial anchor, the greater the drift of the objects attached to the spatial anchor will seem to that user). If you attach content to a nearby anchor (within 3 meters), it will remain in place relative to the anchor, even if the user goes farther away than 3 meters.A spatial anchor is a world-locked frame of reference. It represents a fixed
position and orientation in the real world. You create a spatial anchor at a
specific 6DOF pose and then use it to drive the transform of your virtual
content.
Spatial Anchor Storage Targets Saving a spatial anchor can involve two different types of storage:
- Local Storage: The spatial anchor object is stored directly in the user’s
headset and persists through sessions. This provides the app quick access to
spatial anchors.
Note that once you have saved a spatial anchor in local or cloud storage, you
need its UUID to load it. You must save the spatial anchor UUID to a separate
location to refer to its anchor in a future session.
When you destroy a spatial anchor, you remove the spatial anchor from the user’s
experience. Any virtual object that was using the spatial anchor remains, though
its transforms will no longer be driven by the spatial anchor, so it is no
longer locked to its previous real-world location.
Destroying a spatial anchor does not remove the spatial anchor from local or
cloud storage. If you no longer need the anchor, you should also
erase it from all
storage.
Save a Spatial Anchor Locally or to the Cloud
Note that you only ever need to store spatial anchors to the cloud if you need
to the share the anchors to another user. Otherwise, the parameter is optional
and defaults to local storage for loading the anchor at a later stage.
Save Spatial Anchor UUIDs to External Storage
Load a Saved Spatial Anchor
Erase a Spatial Anchor from Local or Cloud Storage
A spatial anchor can be erased from local or cloud storage. This does not affect
its existence in the user’s experience, but it means the spatial anchor will not
be available in future sessions unless you save it again before the session
ends.