I have a sceneView
where I loaded a 3d model. The model is showing fine and I can controlling it touching the screen.
What I need is to get the values of X, Y, Z rotation while the 3d model is rotating.
How could I get this values in real-time?
I have trying using camera rotation with a gesture recognizer but they are not updating.
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)
}