An object that defines the particular ARKit features you enable in your session at a given time.
SDK
- iOS 11.0+
Framework
- ARKit
Declaration
@interface ARConfiguration : NSObject
Overview
ARConfiguration
defines a base class for the different options your AR experience can have. You don't allocate ARConfiguration
yourself; instead, you instantiate one of its subclasses.
Choose Your Configuration
To implement the features of your AR experience, you create one of the following subclasses and run it on your session via run
. A session can run only one configuration at a time, so choose the one that best facilitates the desired AR experience.
ARWorld
Tracking Configuration Tracks the device's position and orientation relative to any surfaces, people, or known images and objects that ARKit may find and track using the device's back camera.
ARBody
Tracking Configuration Enables you to track a person, planes, and images, using the device's back camera.
AROrientation
Tracking Configuration Tracks only the device's orientation using the back camera.
ARImage
Tracking Configuration Tracks only known images you provide via
tracking
, using the device's back camera.Images ARFace
Tracking Configuration Tracks only faces in the device's selfie camera, including their movement and facial expressions.
ARObject
Scanning Configuration Uses the back camera to collect high-fidelity data about specific objects you want your app to recognize later, at runtime.
ARPositional
Tracking Configuration Tracks only the device's position in 3D space.
Choose Frame Features
Some configurations support sub-features relating to a session's frame. You enable these features by setting the following flags in the configuration's frame
:
ARFrame
Semantic Body Detection Enables 2D human body tracking.
ARFrame
Semantic Person Segmentation Enables people occlusion.
ARFrame
Semantic Person Segmentation With Depth Enables people occlusion based on whether the people in the camera feed are closer to the camera than the virtual content.
Important
Use supports
to verify whether the iOS device supports the ARFrame
you desire before setting frame
.
Switch Configurations at Runtime
When you want to toggle features like plane detection, frame semantics, and environment texturing, you switch your configuration at runtime by calling run
on your existing session. Where possible, ARKit maintains all the information that was collected during the session under the prior configuration, such as information about the physical environment, and anchors.
Note
When you switch your session between face tracking and world tracking configurations, state is not maintained.