0 Replies
      Latest reply on Mar 31, 2018 9:58 PM by Tina.NTT
      Tina.NTT Level 1 Level 1 (0 points)

        Hi guys,

        I have a problem when dragging 3D models.

        I'm using UIPanGestureRecognizer. Like code below.

        But when I drag the object. I can drag it up but I can't drag it down.

        I don't understand why?


        @objc func didMove(_ recognizer: UIPanGestureRecognizer) {
                let location = recognizer.location(in: sceneView)
                let arHitTestResult = sceneView.hitTest(location, types: [.existingPlaneUsingGeometry,.estimatedVerticalPlane,.estimatedHorizontalPlane,.existingPlane,.existingPlaneUsingExtent,.featurePoint])
                if !arHitTestResult.isEmpty {
                    print("You're dragging")
                    guard let selectedNode=(hit?.node) as SCNNode? else { return }
                    let transform = arHitTestResult.first?.worldTransform
                    let newPosition = float3((transform?.columns.3.x)!, ((transform?.columns.3.y)!), (transform?.columns.3.z)!)
                    selectedNode.simdPosition = newPosition