在 SceneKit 中禁用相机平移
Disable camera panning in SceneKit
如果我使用 SceneKit 中的默认相机控件,有没有办法禁用两指平移功能并保持其他功能不变?
我希望用户能够旋转和缩放对象,但根本不能移动它。
没有。你必须自己制作相机并使用手势识别器。
sceneView 已经附加了 UIPanGestureRecognizer。
如果修改它的maximumNumberOfTouches为1,就可以禁用pan手势。
for reco in sceneView.gestureRecognizers! {
if let panReco = reco as? UIPanGestureRecognizer {
panReco.maximumNumberOfTouches = 1
}
}
如果我使用 SceneKit 中的默认相机控件,有没有办法禁用两指平移功能并保持其他功能不变?
我希望用户能够旋转和缩放对象,但根本不能移动它。
没有。你必须自己制作相机并使用手势识别器。
sceneView 已经附加了 UIPanGestureRecognizer。 如果修改它的maximumNumberOfTouches为1,就可以禁用pan手势。
for reco in sceneView.gestureRecognizers! {
if let panReco = reco as? UIPanGestureRecognizer {
panReco.maximumNumberOfTouches = 1
}
}