title: Swift SpriteKit - zRotation in SKAction follow path
body: <p>im working on a game and i have now a question to the zRotation of a SpriteNode while following a path.</p>
  
  <p>So i have a ShapeNode which looks like this:
  <a href="https://i.stack.imgur.com/FljYC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FljYC.png" alt="enter image description here"></a></p>
  
  <p>Im using a UIBezierPath for this Shape.</p>
  
  <p>Now i have a SpriteNode which starts in the middle of this path and moves randomly from the left to the right and otherwise.</p>
  
  <p>For this i have 2 functions:</p>
  
  <pre><code>func FischRechtsBewegen(){ //for moving right
      FischNode1.removeAllActions()
      let BewegeRechts = SKAction.follow(FischKurveRechts.cgPath, asOffset: false, orientToPath: true, duration: 6)
      FischNode1.run(BewegeRechts)
  }
  
  func FischLinksBewegen(){ //for moving left
      FischNode1.removeAllActions()
      let BewegeLinks = SKAction.follow(FischKurveLinks.cgPath, asOffset: false, orientToPath: true, duration: 6)
      FischNode1.run(BewegeLinks)
  }
  </code></pre>
  
  <p>Also in this functions im calculating for each change of the direction a new path for the SpriteNode. (but as this code is not important for my question i removed it in my example code here)</p>
  
  <p>This new path (for the SKAction) begins at the actual position of the SpriteNode and then goes to the right (if the new movement is right) or to the left (if the new movement is left) with an curve to the old start/endpoint.</p>
  
  <p><strong>My problem is now:</strong>
  When moving to the left the SpritesNodes zRotation is exactly how i want it. The node "looks" to the top of the screen. When moving to the right the SpriteNodes zRotation is not good - now the node points to the bottom of the screen which is very ugly.</p>
  
  <p>Ive tried different things - i have changed the image i use for the SpriteNode (the rotation there). I have tried to change the zRotation of the SpriteNode with an action. Nothing helps. Of course because in my SKAction i am saying "orientToPath = true". Im asking now .. is there an easy way to get the SpriteNode always "looking" to the top of the screen or do i have to change the zRotation manually in the update() function?</p>
  
  <p>Im asking because there is this property in the SKAction.follow (orientToPath) and im asking myself if i could use it in this case but if there is a way to change it just a little bit for my need. Or if this is not possible - if the path is going to the left why is the orientToPath  different to the orientToPath in the path which is going to the right?</p>
  
  <p>Here is an video of my problem, maybe its easier to see then what i mean.
  <a href="https://youtu.be/vLH5nUlE91U" rel="nofollow noreferrer">https://youtu.be/vLH5nUlE91U</a></p>