SceneKit Animations on DefaultCameraController

292 Views Asked by At

and pardon my ignorance here. I am brand new with SceneKit. I am trying to get my default camera controller to animate with a sort of smooth "panning motion". I am trying to use something like:

scnView.defaultCameraController.translateInCameraSpaceBy(x: 10, y: 10, z: 10)

When the SCNView enters the view controller.The problem is that this action jumps and I would like it to animate, transitioning from it's current perspective to it's new position where the frames in the transition between the two points in space are represented.

I would like to have this happen on the defaultCameraController as well if possible.

Thanks!

1

There are 1 best solutions below

3
On

A quick solution to get the animation to work is to wrap your translation in an SCNTransaction block.

SCNTransaction.begin()
SCNTransaction.animationDuration = 5
scnView.defaultCameraController.translateInCameraSpaceBy(x: 10, y: 10, z: 10)
SCNTransaction.commit()