0

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!

Mike Perhats
  • 533
  • 1
  • 7
  • 11
  • Hey Mike, Try this post: 57586437 - it's ez to do ur own camera and then you can pretty much do whatever you want. The default camera controller works - kinda, but it has limitations that you probably don't want long term. – Voltan Apr 17 '20 at 14:39

1 Answers1

0

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()
James P
  • 4,786
  • 2
  • 35
  • 52
  • Hey James! Thanks for the answer. Are you aware of a way to chain these, say to animate this back to it's original position? – Mike Perhats Jun 05 '20 at 03:14
  • SCNTransaction has a completion block that you could use to trigger another animation. However I think a better approach would be to create your own camera node and and animate it with SCNActions, it will give you much more control over what you can do. – James P Jun 05 '20 at 10:36
  • Got it! Thanks, James. – Mike Perhats Jun 05 '20 at 15:21