ARKit Calculate distance from a wall to the camera
ARKit Calculate distance from a wall to the camera I’m developing a project with ARKit. I want to calculate the measure from a wall to the camera and it updates when I move away or I move closer. Now, i have activated that it detects horizontal and vertical surfaces. When I get a surface, I calculate the distance from the camera position and the center of the surface. After I apply the calculus that it gets the distance between 2 points in a 3D space (Euclidean). https://math.stackexchange.com/questions/42640/calculate-distance-in-3d-space Is it correct? Can you help me? class ViewController: UIViewController, ARSCNViewDelegate, ARSessionDelegate { let configuration = ARWorldTrackingConfiguration() override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) configuration.planeDetection = [.horizontal, .vertical] sceneView.session.run(configuration) ...... } func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for a...
