I have looked at this post and rickster's answer and lorenzo's sample code
Lorenzo's code works well. I am trying to extend it and add a conventional pan where you can move the scene left, right, up and down.
Here is what I have tried:
-(void) handlePan2F :(UIPanGestureRecognizer*)recognizer {
CGPoint translation = [recognizer translationInView:recognizer.view];
CGFloat xVal = translation.x * 0.025 ; // apply some damping
CGFloat yVal = translation.y * 0.025 ;
if (recognizer.state == UIGestureRecognizerStateChanged) {
self.cameraOrbit.position = SCNVector3Make(-xVal, yVal ,0.0); // what should the value be for z?
}
}
The issues I am running into are:
The pan works kind of - but not well.
If I add a SCNLookAtConstraint to point an area in the scene then the pan2F gesture rotates the scene. Why is that?
- The behavior I am trying to implement is to just to pan left/right/up down over the scene without any scene rotation. How to fix this code?
I am willing to give up SCNLookAtConstraint as long as I can zoom to a specific area within the scene.