Flipped x-scale breaks collision handling (SpriteKit 7.1)

前端 未结 3 1878
感情败类
感情败类 2020-12-16 03:49

I use SKNode\'s xScale property to flip my sprites horizontally. Now, after updating iOS to version 7.1 horizontal flip causes my objects to sink inside the ground. (See ani

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 04:44

    I encountered this problem a couple of days ago. I wanted to invert the sprite based on it's movement (right or left) and found that setting xScale disables any collisions/contacts.

    However, I used this line every time I set the xScale property and everything went back to normal.

    node.xScale = -1.0
    node.physicsBody = node.physicsBody;
    

提交回复
热议问题