title: Fix the camera to a distance from a spritenode
body: <p>I am trying to fix the camera to a sprite node “players.first!” and I managed to do so using SKConstraints as follows</p>
  
  <pre><code>func setupWorld(){
      let playerCamera = SKCameraNode()
      let background = SKSpriteNode(imageNamed: platformType + "BG")
      var cameraFollow = [SKConstraint]()
      cameraFollow.append(SKConstraint.distance(SKRange(constantValue: 0), to: players.first!))
      playerCamera.constraints = cameraFollow
      background.zPosition = layers().backgroundLayer
      background.constraints = cameraFollow
      background.size = self.size
      self.addChild(playerCamera)
      self.camera = playerCamera
      self.addChild(background)
      physicsWorld.contactDelegate = self
      addEmitter()
  }
  </code></pre>
  
  <p>But this keeps the camera fixed to the exact location of the node, I want the camera to be shifted to the right of the node “players.first!” (only in X dimension) and I couldn’t manage to do so with SKConstraints, note that the node is moving fast so updating the position of the camera in the update function makes the camera jitter.</p>
  
  <p><a href="https://i.stack.imgur.com/6Q9WE.jpg" rel="nofollow noreferrer">This image is explaining my issue</a></p>