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
概述
要跟踪真实或虚拟对象相对于相机的位置和方向,请创建锚点对象并使用addAnchor:方法将它们添加到AR会话中。
在世界跟踪会话中启用planeDetection选项时,ARKit还会自动添加锚点
Creating Custom Anchors
- initWithTransform:
Creates a new anchor object with the specified transform.
用指定的变换创建一个新的锚点对象。
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.
参数
transform
一个矩阵,用于编码锚点相对于AR Session的世界坐标空间的位置,方向和比例尺。
ARKit中的世界坐标空间总是遵循右手惯例,但是基于会话配置而定向。 有关详细信息,请参阅关于增强现实和ARKit。
讨论
使用addAnchor:方法开始在AR Session中跟踪自定义锚点。
Tracking Anchors
identifier
A unique identifier for the anchor.
锚点的唯一标识符。
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.
讨论
无论是手动创建一个锚点(使用initWithTransform:初始化程序),还是由ARKit自动创建(并通过ARSessionDelegate,ARSCNViewDelegate或ARSKViewDelegate方法提供给您),每个锚点都会自动接收唯一的标识符值。
您可以使用此值来确定伴随特定ARFrame捕获的锚点对应于之前捕获的帧中的锚点。
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的世界坐标空间的位置,方向和比例尺。
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中的世界坐标空间总是遵循右手惯例,但是基于会话配置而定向。 有关详细信息,请参阅关于增强现实和ARKit。
Inherits From NSObject
Conforms To NSCopying, NSSecureCoding