What's the difference between using ARAnchor to insert a node and directly insert a node?

Viewed 13370

In ARKit, I have found 2 ways of inserting a node after the hitTest

  1. Insert an ARAnchor then create the node in renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode?

     let anchor = ARAnchor(transform:hit.worldTransform)
     sceneView.session.add(anchor:anchor)
    
  2. Insert the node directly

     node.position = SCNVector3(hit.worldTransform.columns.3.x, hit.worldTransform.columns.3.y, hit.worldTransform.columns.3.z)
     sceneView.scene.rootNode.addChildNode(node)
    

Both look to work for me, but why one way or the other?

2 Answers
Related