title: How to move and rotate SCNode using ARKit and Gesture Recognizer?
body: <p>I am working on an AR based iOS app using ARKit(SceneKit). I used the Apple sample code <a href="https://developer.apple.com/documentation/arkit/handling_3d_interaction_and_ui_controls_in_augmented_reality" rel="nofollow noreferrer">https://developer.apple.com/documentation/arkit/handling_3d_interaction_and_ui_controls_in_augmented_reality</a> as base for this. Using this i am able to move or rotate the whole Virtual Object. </p>
  
  <p>But i want to select and move/rotate a Child Node in Virtual object using user finger, similar to how we move/rotate the whole Virtual Object itself. </p>
  
  <p>I tried the below two links but it is only moving the child node in particular axis but not freely moving anywhere as the user moves the finger. </p>
  
  <p><a href="https://stackoverflow.com/questions/46825140/arkit-drag-a-node-along-a-specific-axis-not-on-a-plane?rq=1">ARKit - Drag a node along a specific axis (not on a plane)</a></p>
  
  <p><a href="https://stackoverflow.com/questions/44729610/dragging-scnnode-in-arkit-using-scenekit">Dragging SCNNode in ARKit Using SceneKit</a></p>
  
  <p>Also i tried replacing the Virtual Object which is a SCNReferenceNode with SCNode so that whatever functionality present for existing Virtual Object applies to Child Node as well, it is not working. </p>
  
  <p>Can anyone please help me on how to freely move/rotate not only the Virtual Object but also the child node of a Virtual Object?</p>
  
  <p>Please find the code i am currently using below,</p>
  
  <pre><code>       let tapPoint: CGPoint = gesture.location(in: sceneView)
          let result = sceneView.hitTest(tapPoint, options: nil)
          if result.count == 0 {
              return
          }
          let scnHitResult: SCNHitTestResult? = result.first
          movedObject = scnHitResult?.node //.parent?.parent
  
          let hitResults = self.sceneView.hitTest(tapPoint, types: .existingPlane)
          if !hitResults.isEmpty{
              guard let hitResult = hitResults.last else { return }
              movedObject?.position = SCNVector3Make(hitResult.worldTransform.columns.3.x, hitResult.worldTransform.columns.3.y, hitResult.worldTransform.columns.3.z)
          }
  </code></pre>