【发布时间】:2017-11-18 14:43:06
【问题描述】:
我有一个sceneView,我在其中加载了一个 3d 模型。模型显示良好,我可以控制它触摸屏幕。
我需要的是在 3d 模型旋转时获取 X、Y、Z 旋转的值。
如何实时获取这些值?
我尝试使用带有手势识别器的相机旋转,但它们没有更新。
override func viewDidLoad() {
super.viewDidLoad()
sceneView.scene = SCNScene(named: "PKB2");
sceneView.autoenablesDefaultLighting = true
sceneView.allowsCameraControl = true
// add a tap gesture recognizer
let tapGesture = UITapGestureRecognizer(target: self, action:
#selector(handleTap(_:)))
sceneView.addGestureRecognizer(tapGesture)
}
func handleTap(_ gestureRecognize: UIGestureRecognizer) {
// retrieve the SCNView
let cameraNode = SCNNode()
cameraNode.camera = SCNCamera()
print(cameraNode.rotation)
}
【问题讨论】:
标签: ios 3d rotation scenekit collada