Why does orient Path = true cause the sprite node to rotate CW when the path is horizontal?

Why does orient Path = true cause the sprite node to rotate CW when the path is horizontal?

Here's just one example:

    let trainAction = SKAction.follow(
                                  trainPath.cgPath,
                                  asOffset: false,
                                  orientToPath: true,
                                  duration: 0.1)
    myTrain.run(trainAction.reversed())

I have myTrain.zRotation = 0.0

myTrain is a simple locomotive,trainPath = the railroad tracks

Docs state with orientToPath: true, that the Node will always orient itself such that it's facing the UIBezierPath.

To me, facing means that the wheels of the locomotive are facing the BezierPath (= trainPath)

Apparently I am wrong in this interpretation ... if so, what is the correct interpretation?

FYI, comparing the snapshot of my initial placement of the locomotive on the tracks using .position with what happens after I start moving the locomotive:

These snapshots indicate that facing means that the nose of the locomotive is facing the BezierPath (= trainPath).

If true, how do I eliminate that CW rotation?

  • I have investigated altering the pivot point of the SKSpriteNode .. I have even changed its anchorPoint .. no change. I am definitely ready to cry "Uncle" here.

Add a Comment