title: How to change SCNView pivot point
body: <h2>Question</h2>
  <p>How does the <code>SceneView</code>/<code>camera</code> work out around which point to rotate, and how do I force the scene to rotate around the red sphere (-2, 0, 0)?</p>
  <h2>Demo</h2>
  <p>In this example SceneView I have placed</p>
  <ul>
  <li>a camera at <code>(-2, 0, 5)</code></li>
  <li>a red sphere at <code>(-2, 0, 0)</code></li>
  <li>a blue sphere at <code>(-1, 0, 0)</code></li>
  <li>a white sphere at <code>(0, 0, 0)</code></li>
  </ul>
  <p>So the camera is in the same position along the x-axis as the red sphere</p>
  <p>In the image you see the scene rotates around the blue sphere.</p>
  <p><a href="https://i.stack.imgur.com/hK0gT.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hK0gT.gif" alt="enter image description here" /></a></p>
  <h2>Playground example</h2>
  <p>Here is a working playground to produce the above example</p>
  <pre class="lang-swift prettyprint-override"><code>import UIKit
  import SceneKit
  import PlaygroundSupport
  
  var scene = SCNScene()
  
  var sceneView: SCNView = {
      let s = SCNView(
          frame: CGRect(x: 0, y: 0, width: 600, height: 600)
      )
      s.scene = scene
      s.backgroundColor = UIColor.black
      s.allowsCameraControl = true
      return s
  }()
  
  PlaygroundPage.current.liveView = sceneView
  
  let redXPosition: simd_float1 = -2.0
  let blueXPosition: simd_float1 = -1.0
  let originXPosition: simd_float1 = 0.0
  
  
  // MARK: Scene Nodes
  let cameraNode: SCNNode = {
      let n = SCNNode()
      n.camera = SCNCamera()
      n.camera?.contrast = 0.0
      n.camera?.wantsHDR = false
      return n
  }()
  
  cameraNode.simdPosition = simd_float3(redXPosition, 0, 5)
  scene.rootNode.addChildNode(cameraNode)
  
  let ambientLightNode: SCNNode = {
      let n = SCNNode()
      n.light = SCNLight()
      n.light!.type = SCNLight.LightType.ambient
      n.light!.color = UIColor(white: 0.75, alpha: 1.0)
      return n
  }()
  
  ambientLightNode.simdPosition = simd_float3(0,5,0)
  scene.rootNode.addChildNode(ambientLightNode)
  </code></pre>
  <pre class="lang-swift prettyprint-override"><code>// MARK: Spheres
  
  // MARK: Origin - White
  let originNode: SCNNode = {
      let sphere = SCNSphere(radius: 0.5)
      let node = SCNNode(geometry: sphere)
      let mat = SCNMaterial()
      mat.diffuse.contents = UIColor.white
      sphere.materials = [mat]
      return node
  }()
  
  // MARK: Red
  let redNode: SCNNode = {
      let sphere = SCNSphere(radius: 0.3)
      let node = SCNNode(geometry: sphere)
      let mat = SCNMaterial()
      mat.diffuse.contents = UIColor.red
      sphere.materials = [mat]
      return node
  }()
  
  // MARK: Blue
  let blueNode: SCNNode = {
      let sphere = SCNSphere(radius: 0.3)
      let node = SCNNode(geometry: sphere)
      let mat = SCNMaterial()
      mat.diffuse.contents = UIColor.blue
      sphere.materials = [mat]
      return node
  }()
  
  // MARK: Place nodes in scene
  originNode.simdPosition = simd_float3(originXPosition,0,0)
  redNode.simdPosition = simd_float3(redXPosition,0,0)
  blueNode.simdPosition = simd_float3(blueXPosition,0,0)
  
  
  scene.rootNode.addChildNode(originNode)
  scene.rootNode.addChildNode(redNode)
  scene.rootNode.addChildNode(blueNode)
  </code></pre>