如何在SceneKit中更改与相机交互的样式?

时间:2018-09-27 08:52:42

标签: ios swift macos scenekit scncamera

我有一个具有SCNCamera的SCNNode

let cameraNode = SCNNode()  
cameraNode.camera = SCNCamera()
cameraNode.camera?.name = "camera"
cameraNode.camera?.automaticallyAdjustsZRange = true
cameraNode.camera?.usesOrthographicProjection = true
cameraNode.camera?.orthographicScale = vport.getHeight()
cameraNode.position = SCNVector3(vport.x, vport.y, vport.getHeight())

我正在创建SCNScene

let scene = SCNScene()
scene.rootNode.addChildNode(node)    
scnView.scene = scene

scnView.allowsCameraControl = false

然后我尝试更改相机的位置

override func mouseDragged(with event: NSEvent) {
    scnView.defaultCameraController.translateInCameraSpaceBy(x: Float(-event.deltaX), y: Float(event.deltaY), z: 0.0)
}

问题是相机移动的距离比鼠标光标大。 在iOS项目中使用UIPanGestureRecognizer时,我遇到了同样的问题

0 个答案:

没有答案