Reputation: 165
Please Help me, I have setup "allowsCameraControl = true" in Scene view. How to disabled some default functionality. Ex : Pan with two fingers to translate the camera on its local xy-plane
scnview.allowsCameraControl = true
scnview.defaultCameraController.interactionMode = .orbitTurntable
scnview.defaultCameraController.inertiaEnabled = true
scnview.defaultCameraController.maximumVerticalAngle = 69
scnview.defaultCameraController.minimumVerticalAngle = -69
scnview.autoenablesDefaultLighting = true
Upvotes: 3
Views: 1377
Reputation: 51
To block some gestures used in build-in camera controller:
- pan with 1 finger to rotate the camera around the scene
- pan with 2 fingers to translate the camera on its local X,Y plan
- pan with 3 fingers vertically to move the the camera forward/backward
You can change cameraControlConfiguration sensitivity properties. In your case it is gonna be 'panSensitivity'. But I would recommend to block 'truckSensitivity' too.
scnview.cameraControlConfiguration.panSensitivity = 0
Upvotes: 0
Reputation: 607
You can disable/modify or add more recognisers after setting allowsCameraControl = true
.
if let recognizers = scnview.gestureRecognizers {
for gestureRecognizer in recognizers {
if let gesture = gestureRecognizer as? UIPanGestureRecognizer {
gestureRecognizer.isEnabled = false
}
}
}
Upvotes: 3
Reputation: 1463
Look at SCNCameraControlConfiguration (https://developer.apple.com/documentation/scenekit/scncameracontrolconfiguration)
It has some variables for controlling the default camera behavior. It particular there is a "allowsTranslation" variable that controls two finger panning.
That said, I've had mixed results using this to control the behavior.
Upvotes: -1