简体   繁体   中英

Disable camera panning in SceneKit

If I am using the default camera control in SceneKit, is there a way to disable the two fingered pan function and leave the others as they are?

I want users to be able to rotate and zoom an object, but not move it at all.

The sceneView already has a UIPanGestureRecognizer attached. If you modify its maximumNumberOfTouches to be 1, you can disable the pan gesture.

for reco in sceneView.gestureRecognizers! {
    if let panReco = reco as? UIPanGestureRecognizer {
        panReco.maximumNumberOfTouches = 1
    }
}

不,您必须制作自己的相机并使用手势识别器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM