swift - ARKit 中 x、y 和 z 的 SCNVector3 位置使用哪个测量单位

标签 swift arkit

让位置 = SCNVector3(x: 0, y: 0, z: -2) 从原点到上述点的测量单位距离是多少

最佳答案

ARKit 中,测量单位是

enter image description here

当您启动您的 ARKit 应用程序时,worldOrigin 设置为 SCNVector3Zero,即 (0,0,0)(或在 X、Y、 Z轴相交):

ARKit defines a world coordinate space for you to use to place virtual content and locate detected objects in an AR experience. By default, this space is based on the initial position and orientation of the device when the session begins.

SCNVector3 很简单:

a three-component vector which is used for a variety of purposes, such as describing node or vertex positions, surface normals, and scale or translation transforms. The different vector components should be interpreted based on the context in which the vector is being used.

因此每个部分对应于 X、Y 和 Z 值例如:

let position = SCNVector3 (x, y, z)

鉴于您的position var,您是说您想要将对象放置在关于worldOrigin 的中心位置,并且距离相机 2 米。

希望对你有帮助

关于swift - ARKit 中 x、y 和 z 的 SCNVector3 位置使用哪个测量单位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51760421/

相关文章:

ios - 在 Swift 中从 Tableviewcell 中关闭 Popover ViewController

Swift:动态调整 UICollectionViewCell 大小

swift - RealityKit – 从同一个 Reality Composer 项目加载另一个场景

ios - 如何在 ARkIt 2 中将图像包裹在 3d 对象上?

swift - 同时添加多个SCNNode

ios - Alamofire 向 twilio Swift 发出请求

ios - Swift 设置按钮图片

ios - 如何修复变量 'fetchRequest' 已写入,但从未读取过 CoreData

ios - ARKit - 在相机上居中 SCNode

swift - 为什么在使用 ARSCNView 关闭 ViewController 时 UI 会卡住?