1
votes
  1. In Xcode 8.3.3, set a SKSpriteNode as a child of a SKNode.

    1. Create a SKPhysicsBody to the SKSpriteNode.
    2. Add an SKAction.rotate to the SKSpriteNode.
    3. Then set the xScale to -1 for SKSpriteNode ( in touchesBegan )
    4. the result is that the SKAction is reversed wrongly

    5. .....

    6. Next, instead of SKSpriteNode, set the xScale to -1 for SKNode ( in touchesBegan )
    7. this time, the SKPhysicsBody and the SKSpriteNode are separated each into mirrored SKActions

Is this a bug or it could be fixed somehow (without creating and adding a mirrored version of the SKSpriteNode)

Thank you for your help

1

1 Answers

1
votes

In case 1, the sprite scales before rotation is applied, this is why it still goes in the same direction as if not flipped

In case 2, the sprite scales after rotation is applied, this is why you now get the correct direction.

As for the SKPhysicsBody, it is a bug with how they apply their affine transformation changes.

It does not pick up on the sign of the number, and this is why the body is going the wrong way.