How to calculate the distance from the camera to a node in ARKit.

Oscar de la Hera
AR Tips And Tricks
Published in
1 min readNov 21, 2018
Related image

Use the line below, where YOUR_NODE — is your node.

let distance = simd_distance(YOUR_NODE.simdTransform.columns.3, (sceneView.session.currentFrame?.camera.transform.columns.3)!);

O

--

--

Oscar de la Hera
AR Tips And Tricks

Oscar is an award-winning Spanish Inventor whose work impacts lives through brands that include Nike, MoMA and Samsung.