Class

ARWorldMap

The space-mapping state and set of anchors from a world-tracking AR session.

Declaration

class ARWorldMap : NSObject

Overview

The session state in a world map includes ARKit's awareness of the physical space the user moves the device in (which ARKit uses to determine the device's position and orientation), as well as any ARAnchor objects added to the session (which can represent detected real-world features or virtual content placed by your app).

After you use getCurrentWorldMap(completionHandler:) to save a session's world map, you can assign it to a configuration's initialWorldMap property and use run(_:options:) to start another session with the same spatial awareness and anchors.

By saving world maps and using them to start new sessions, your app can add new AR capabilities:

  • Multiuser AR experiences. Create a shared frame of reference by sending archived ARWorldMap objects to a nearby user's device. With two devices tracking the same world map, you can build a networked experience where both users can see and interact with the same virtual content.

  • Persistent AR experiences. Save a world map when your app becomes inactive, then restore it the next time your app launches in the same physical environment. You can use anchors from the resumed world map to place the same virtual content at the same positions from the saved session.

Topics

Saving and Loading World Maps

Archiving World Map Data for Persistence or Sharing

Serialize and deserialize world map objects for file storage or network transmission.

Examining a World Map

var anchors: [ARAnchor]

The set of anchors recorded in the world map.

var center: simd_float3

The center point of the world map's space-mapping data, relative to the world coordinate origin of the session the map was recorded in.

var extent: simd_float3

The size of the world map's space-mapping data, relative to the world coordinate origin of the session the map was recorded in.

Debugging a World Map

var rawFeaturePoints: ARPointCloud

A coarse representation of the space-mapping data recorded in the world map.

Relationships

Inherits From

See Also

AR World Sharing and Persistence

Creating a Multiuser AR Experience

Transmit ARKit world-mapping data between nearby devices with the MultipeerConnectivity framework to create a shared basis for AR experiences.

Creating a Persistent AR Experience

Save and load ARKit world-mapping data to allow users to return to previous AR experiences in the same real-world environment.