0

I am attempting to animate the camera node in Scenekit while having the camera look at a specific point with a constraint. For some reason activating the constraint locks the camera position. Is there a specific reason this does not work or what am I missing here?

cameraNode = SCNNode()
let camera = SCNCamera()
cameraNode.camera = camera
cameraNode.position = SCNVector3Make(5.0, 10.0, 5.0)

scene.rootNode.addChildNode(cameraNode)

let center = SCNNode()
center.position = SCNVector3Make(0, 0, 0)
let lookConstraint = SCNLookAtConstraint(target: center)
cameraNode.constraints = [lookConstraint]        

let firstAnimation = SCNAction.move(to: SCNVector3Make(10, 10, 10), duration: 2.0)
let secondAnimation = SCNAction.move(by: SCNVector3Make(0, 5, 5), duration: 2.0)
let sequence = SCNAction.sequence([firstAnimation, secondAnimation])

cameraNode.runAction(sequence)
Pete
  • 213
  • 1
  • 13
  • 2
    This is the same problem as described [here](http://stackoverflow.com/questions/30620806/apply-scnaction-to-a-node-with-constraints-in-scenekit) – jlsiewert May 08 '17 at 09:23
  • Thanks a million, I didn't see the other answer! – Pete May 08 '17 at 09:29
  • 1
    Possible duplicate of [Apply SCNAction to a node with constraints in SceneKit](http://stackoverflow.com/questions/30620806/apply-scnaction-to-a-node-with-constraints-in-scenekit) – Hal Mueller May 09 '17 at 20:58

0 Answers0