title: SceneKit – Rotate and animate a SCNNode
body: <p>I'm trying to display a pyramid that points following the z axis and then rotates on itself around z too.
  As my camera is on the z axis, I'm expecting to see the pyramid from above. I managed to rotate the pyramid to see it this way but when I add the animation it seems to rotate on multiple axis.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>// The following create the pyramid and place it how I want
  let pyramid = SCNPyramid(width: 1.0, height: 1.0, length: 1.0)
  let pyramidNode = SCNNode(geometry: pyramid)
  pyramidNode.position = SCNVector3(x: 0, y: 0, z: 0)
  pyramidNode.rotation = SCNVector4(x: 1, y: 0, z: 0, w: Float(M_PI / 2))
  scene.rootNode.addChildNode(pyramidNode)
  
  // But the animation seems to rotate aroun 2 axis and not just z
  var spin = CABasicAnimation(keyPath: "rotation")
  spin.byValue = NSValue(SCNVector4: SCNVector4(x: 0, y: 0, z: 1, w: 2*Float(M_PI)))
  spin.duration = 3
  spin.repeatCount = HUGE
  pyramidNode.addAnimation(spin, forKey: "spin around")
  </code></pre>