I'm developing an app showing a 3D human body - in the SceneKit editor, I've set up the camera pointing to the model.
As I did set sceneView.allowsCameraControl = true, the user can move around the object, zoom in and zoom out with simple gestures.
In order to move vertically, I've implemented an UISlider - I don't want the user to pan vertically with two finger gestures.
In the slider action, I do the following:
@IBAction func sliderDidMove(_ sender: UISlider) {
cameraNode = sceneView.scene?.rootNode.childNode(withName: "camera", recursively: true)
let vert = 1.5*(0.5 - sender.value)
cameraNode?.position.y = posY + vert
}
This works fine when I change the slider position just after loading my ViewController. But as soon as I rotate or zoom the model by gestures, the slider no longer shows effect - thus I can no longer change the position of my camera node programmatically.
Has anyone an idea how I can fix this?