3 Replies
      Latest reply on Apr 16, 2018 8:14 PM by Tina.NTT
      Tina.NTT Level 1 Level 1 (0 points)

        Hi, guys. I have a problem with drag and rotate SCNNode in ARKit.

        When I rotate or move the node. It just moves one child node. How can I wrap them into one parent node?
        Can you help me? I'm so exhausted to find out the answer.

        • Re: If parent Node will be moved, childnodes will followed.
          Ysee-kzsln Level 1 Level 1 (0 points)

          You can wrap all nodes into a parent node by using the SceneKit Editor -> Scene Graph -> Add a child node and move them into the parent.

            • Re: If parent Node will be moved, childnodes will followed.
              Tina.NTT Level 1 Level 1 (0 points)

              I did. But when I use hitTest.first.node, the childnode will be touch, not all parts of the object.

              Can you look at my code?

              Here is my code when touching:

                     let location = recognizer.location(in: sceneView)
                      var hitTestOptions = [SCNHitTestOption: Any]()
                      hitTestOptions[SCNHitTestOption.boundingBoxOnly] = true
                      let hit=sceneView.hitTest(location, options: hitTestOptions).first
                          print("You're dragging")
                          guard let selectedNode=(hit?.node) as SCNNode? else { return }
                          let transform = arHitTestResult.last?.worldTransform
                          let newPosition = float3((transform?.columns.3.x)!, ((transform?.columns.3.y)!), (transform?.columns.3.z)!)
                          selectedNode.simdPosition = newPosition
                          sceneView.scene.rootNode.addChildNode(selectedNode)
                      
              
              • Re: If parent Node will be moved, childnodes will followed.
                Tina.NTT Level 1 Level 1 (0 points)

                I did it. Thank you so much.