Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zoom in and out of a scene?

Tags:

scenekit

What is the correct way to zoom in and out of a scene in SceneKit?

So when I enable the standard camera control in a scene and pinch in and out the scene gets bigger and smaller. What is that pinch really doing?

Is it changing the scale of the whole scene? Is it moving the camera closer?

I want to implement the same effect but programmatically.

What should I do to obtain the same effect?

like image 633
zumzum Avatar asked Sep 29 '22 23:09

zumzum


1 Answers

When you pinch it's the field of view (xFox and yFov properties) of your camera that's changed. Changing the field of view is not the best way to zoom because it can dramatically change the perspective.

Moving the camera closer to your object is a good solution.

Also note that the "free camera" behavior is suitable for 3D viewers (such as Preview.app) but will rapidly become frustrating in any other app. At this point you might want to implement your own camera controller.

like image 178
mnuages Avatar answered Dec 31 '22 22:12

mnuages