A real-world position and orientation that can be used for placing objects in an AR scene.
真實世界的位置和方向,可用于將對象放置在AR場景中。
Overview
To track the positions and orientations of real or virtual objects relative to the camera, create anchor objects and use the?addAnchor:?method to add them to your AR session.
ARKit also automatically adds anchors when you enable the?planeDetection?option in a world tracking session
概述
要跟蹤真實或虛擬對象相對于相機的位置和方向键闺,請創(chuàng)建錨點對象并使用addAnchor:方法將它們添加到AR會話中恒傻。
在世界跟蹤會話中啟用planeDetection選項時,ARKit還會自動添加錨點
? ? ? ? ? ? ? ? ? ? Creating Custom Anchors
-?initWithTransform:
Creates a new anchor object with the specified transform.
用指定的變換創(chuàng)建一個新的錨點對象。
Parameters
transform
A matrix encoding the position, orientation, and scale of the anchor relative to the world coordinate space of the AR session the anchor is placed in.?
World coordinate space in ARKit always follows a right-handed convention, but is oriented based on the session configuration. For details, see?About Augmented Reality and ARKit.
Discussion
Use the?addAnchor:?method to begin tracking your custom anchor in an AR session.
參數(shù)
transform
一個矩陣扇住,用于編碼錨點相對于AR Session的世界坐標(biāo)空間的位置春缕,方向和比例尺。
ARKit中的世界坐標(biāo)空間總是遵循右手慣例艘蹋,但是基于會話配置而定向锄贼。 有關(guān)詳細信息,請參閱關(guān)于增強現(xiàn)實和ARKit女阀。
討論
使用addAnchor:方法開始在AR Session中跟蹤自定義錨點宅荤。
? ? ? ? ? ? ? ? ? ? ? ? ? ? Tracking Anchors
identifier
A unique identifier for the anchor.
錨點的唯一標(biāo)識符。
Discussion
Whether an anchor is created manually (with the?initWithTransform:?initializer) or automatically by ARKit (and provided to you through?ARSessionDelegate,?ARSCNViewDelegate, or?ARSKViewDelegate?methods), each anchor automatically receives a unique identifier value.
You can use this value to determine which anchors accompanying a specific?ARFrame?capture correspond to anchors in frames captured previously.
討論
無論是手動創(chuàng)建一個錨點(使用initWithTransform:初始化程序)浸策,還是由ARKit自動創(chuàng)建(并通過ARSessionDelegate冯键,ARSCNViewDelegate或ARSKViewDelegate方法提供給您),每個錨點都會自動接收唯一的標(biāo)識符值庸汗。
您可以使用此值來確定伴隨特定ARFrame捕獲的錨點對應(yīng)于之前捕獲的幀中的錨點琼了。
transform
A matrix encoding the position, orientation, and scale of the anchor relative to the world coordinate space of the AR session the anchor is placed in.
一個矩陣,用于編碼錨點相對于AR Session的世界坐標(biāo)空間的位置夫晌,方向和比例尺雕薪。
Discussion
World coordinate space in ARKit always follows a right-handed convention, but is oriented based on the session configuration. For details, see?About Augmented Reality and ARKit.
討論
ARKit中的世界坐標(biāo)空間總是遵循右手慣例,但是基于會話配置而定向晓淀。 有關(guān)詳細信息所袁,請參閱關(guān)于增強現(xiàn)實和ARKit。
Inherits From?NSObject
Conforms To?NSCopying,?NSSecureCoding