title: Scenekit Pan 2D Translation to Orthographic 3D only horizontal
body: <p>I am having a little more mathematical problem with 3D programming and I am hoping you can help me!</p>
  
  <p>I am trying to create a 3D game using Scenekit with a isometric angle.</p>
  
  <p>This code creates my orthographic camera:</p>
  
  <pre><code>var cameraNode = SCNNode()
  cameraNode.camera = SCNCamera()
  cameraNode.name = "Camera"
  cameraNode.position = SCNVector3Make(-5.0, -5.0, 10.0)
  cameraNode.eulerAngles = SCNVector3Make(PI / 3.0, 0.0, -PI / 4.0)
  cameraNode.camera?.usesOrthographicProjection = true
  cameraNode.camera?.orthographicScale = 7.0
  scene.rootNode.addChildNode(cameraNode)
  </code></pre>
  
  <p>Now i want to move the camera using a pan gesture, producing a scroll feeling. To make this possible the camera shouldn't move vertically, only horizontally. The touch location on screen and the unprojected position in the 3D world should stay the same while moving.</p>
  
  <p>I thought about calculating the 2D translation into 3D difference and ignoring the vertical component. This code actually works and almost produces the desired result, but the speed is not correct. If I pan, the camera seems to accelerate and not react correctly:</p>
  
  <pre><code>var previousTranslation = CGPointMake(0.0, 0.0)
  
  func pan(gesture: UIPanGestureRecognizer)
  {
      let view = self.view as SCNView
      let translation = gesture.translationInView(view)
      let location = gesture.locationInView(view)
  
      let diffTrans = translation - previousTranslation
      previousTranslation = translation
  
      let cameraNode = scene.rootNode.childNodeWithName("Camera", recursively: false)
  
      let worldPointTrans = view.unprojectPoint(SCNVector3Make(-Float(diffTrans.x), -Float(diffTrans.y), 0.0))
      let worldPoint0 = view.unprojectPoint(SCNVector3Make(0.0, 0.0, 0.0))
  
      var diff = worldPointTrans - worldPoint0
      diff.x = diff.x / Float(cameraNode!.camera!.orthographicScale)
      diff.y = diff.y / Float(cameraNode!.camera!.orthographicScale)
      diff.z = 0
      cameraNode?.position += diff
  }
  </code></pre>
  
  <p>Does anybody know a sophisticated way of calculating a screen translation into a horizontal 3D translation, ignoring the vertical axis?</p>
  
  <p>Thank you in advance :)</p>
  
  <p>EDIT:
  The pan works for horizontal translation now. But not for vertical, because I set the difference on the z axis to zero.</p>