Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default camera position not changing?

Tags:

scenekit

So I am trying to understand how allowsCameraControl really work.

I have a scene and I set the allowsCameraControl = true. When I pan around and the scene rotates, or translates (two fingers...), I don't understand what scene kit really changes for me.

I was expecting the camera node to change position, or rotation. Not the case. I also logged the position and rotation of the rootNode of the scene...no change.

So just to be clear, in the render delegate called for every frame update, I log the position and rotation of the camera node I set for the scene, I logged the position and rotation of the root node, I also logged te position and rotation of a node I added to the scene. None of these show any change in position and or rotation.

Can anyone explain to me what scene kit changes when the scene rotates or translates using the standard camera controls?

like image 262
zumzum Avatar asked Jan 19 '15 04:01

zumzum


2 Answers

A new camera is indeed created, leaving the original one unchanged. The scene graph is also unchanged. The new camera is not part of the scene graph and can be accessed with scnView.pointOfView

like image 118
Toyos Avatar answered Oct 16 '22 17:10

Toyos


A new camera is created, leaving the original one unchanged.

If you show the inspector using the showsStatistics property, you'll notice the Point of View changes from the camera you had (even if it is "Untitled") to kSCNFreeViewCameraName.

Sadly there is not much documentation about this behavior but you might be able to find it in the node hierarchy.

Let us know what you find!

like image 23
Moustach Avatar answered Oct 16 '22 16:10

Moustach