A configuration that uses the back-facing camera, tracks a device's orientation and position, and detects real-world flat surfaces.
使用背面照相機的配置,跟蹤設備的方向和位置,并檢測真實世界的平面。
Overview
All AR configurations establish a correspondence between the real world the device inhabits and a virtual 3D coordinate space where you can model content. When your app displays that content together with a live camera image, the user experiences the illusion that your virtual content is part of the real world.?
Creating and maintaining this correspondence between spaces requires tracking the device's motion. The?ARWorldTrackingConfiguration?class tracks the device's movement with six degrees of freedom (6DOF): specifically, the three rotation axes (roll, pitch, and yaw), and three translation axes (movement in x, y, and z).
This kind of tracking can create immersive AR experiences: A virtual object can appear to stay in the same place relative to the real world, even as the user tilts the device to look above or below the object, or moves the device around to see the object's sides and back.
概述
所有AR配置都可以在設備居住的真實世界與虛擬3D坐標空間之間建立對應關系,您可以在其中對內容進行建模。 當您的應用程序將該內容與實時相機圖像一起顯示時,用戶會體驗到虛擬內容是真實世界的一部分的錯覺。
在空間之間創建和維護這種對應關系需要跟蹤設備的運動。 ARWorldTrackingConfiguration類以六個自由度(6DOF)跟蹤設備的運動:特別是三個旋轉軸(滾動,俯仰和偏航)以及三個平移軸(在x,y和z中的移動)。
這種追蹤可以創造逼真的AR體驗:虛擬物體可以看起來與真實世界保持相同的位置,即使用戶將設備傾斜到物體的上方或下方,或者移動設備以查看 物體的側面和背面。
If you enable the?planeDetection?setting, ARKit analyzes the scene to find real-world horizontal or vertical surfaces. For each plane detected, ARKit automatically adds an?ARPlaneAnchor?object to the session.?
If you provide images for the detectionImages property, ARKit analyzes the scene to recognize those images. For each detected image, ARKit automatically adds an?ARImageAnchor?object to the session.
如果啟用planeDetection設置,ARKit將分析場景以查找真實世界的水平或垂直表面。 對于檢測到的每個平面,ARKit會自動將ARPlaneAnchor對象添加到會話中。
如果您為detectionImages屬性提供圖像,ARKit會分析場景以識別這些圖像。 對于每個檢測到的圖像,ARKit會自動將ARImageAnchor對象添加到會話中。
? ? ? ? ? ? ? ? ? ? ? ? ? Creating a Configuration
-?init
Creates a new world tracking configuration.
創建新的世界跟蹤配置。
? ? ? ? ? ? ? ? ? ? ? ? ?Enabling Plane Detection
planeDetection
A value specifying whether and how the session attempts to automatically detect flat surfaces in the camera-captured image.
一個值用來表明是否開啟平面檢測以及判別是哪種平面的值。
Discussion
By default, plane detection is off. If you enable?ARPlaneDetectionHorizontal?or?ARPlaneDetectionVertical?plane detection, the session adds?ARPlaneAnchor?objects and notifies your?ARSessionDelegate,?ARSCNViewDelegate, or?ARSKViewDelegate?object whenever its analysis of captured video images detects an area that appears to be a flat surface.
討論
默認情況下,平面檢測已關閉。 如果啟用ARPlaneDetectionHorizontal或ARPlaneDetectionVertical平面檢測,會話將添加ARPlaneAnchor對象,并在其捕獲的視頻圖像的分析檢測到看似平坦的區域時,通知您的ARSessionDelegate,ARSCNViewDelegate或ARSKViewDelegate對象。
ARPlaneDetection
Options for whether and how ARKit detects flat surfaces in captured images.
ARKit是否以及如何檢測拍攝圖像中的平坦表面的選項。
Plane Detection Options
ARPlaneDetectionHorizontal
The session detects planar surfaces that are perpendicular to gravity.
會話檢測垂直于重力的平面。
ARPlaneDetectionVertical
The session detects surfaces that are parallel to gravity (regardless of other orientation).
會話檢測平行于重力的平面。
ARPlaneDetectionNone
Plane detection is disabled.
平面檢測不可用
? ? ? ? ? ? ? ? ? ? ? Enabling Image Detection
detectionImages
A set of images for ARKit to attempt to detect in the user's environment.
ARKit嘗試在用戶環境中檢測的一組圖像。
Discussion
Use this property to choose known 2D images for ARKit to find in the user's environment and present as?ARImageAnchor?for use in your AR experience. Use Xcode to define reference images for ARKit to detect, or define them programmatically with the?ARReferenceImageclass.?
For example, you might use this feature to create a AR experience where, when the user encounters a certain movie poster, space ships or cartoon characters appear to emerge from the poster and inhabit the user's environment.
討論
使用此屬性可以為ARKit選擇已知的2D圖像,以便在用戶環境中查找并以ARImageAnchor的形式顯示,以便用于您的AR體驗。 使用Xcode為ARKit定義參考圖像來檢測,或使用ARReferenceImageclass以編程方式定義它們。
例如,您可以使用此功能創建AR體驗,其中當用戶遇到某個電影海報時,太空飛船或卡通人物會從海報中浮現出來,并置身于用戶的環境中。
? ? ? ? ? ? ? ? ? ? ? ?Managing Device Camera Behavior
autoFocusEnabled
A Boolean value that determines whether the device camera uses fixed focus or autofocus behavior.
一個布爾值,用于確定設備相機是使用固定焦點還是自動聚焦行為。
Discussion
In apps linked against the iOS 11.3 SDK or later, ARKit enables autofocus by default.
在與iOS 11.3 SDK或更高版本鏈接的應用程序中,ARKit默認啟用自動對焦。
Inherits From ? ?ARConfiguration