Which measuring unit is used in SCNVector3 position for x, y and z in ARKit

牧云@^-^@ 提交于 2019-12-13 02:35:39

问题


let position = SCNVector3(x: 0, y: 0, z: -2) what is the distance in measuring units from the origin to the above point


回答1:


In ARKit the unit of measurement is in Meters.

When you launch your ARKit app, the worldOrigin is set at SCNVector3Zero which is (0,0,0) (or in the diagram where the X,Y,Z axis intersect):

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.

An SCNVector3 is simply:

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.

So each part corresponds to the X, Y and Z values e.g:

let position = SCNVector3 (x, y, z)

Given your position var you are saying that you want to place the object centrally in regard to the worldOrigin and 2meters away from the camera.

Hope it helps...



来源:https://stackoverflow.com/questions/51760421/which-measuring-unit-is-used-in-scnvector3-position-for-x-y-and-z-in-arkit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!