Which measuring unit is used in SCNVector3 positio

2019-08-08 09:11发布

问题:

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...



标签: swift arkit