Does SpriteKit apply physics if I modify the position and rotation of a SKSpriteNode directly without an SKAction?

后端 未结 2 1457
栀梦
栀梦 2021-01-14 18:10

For example if I want to do my own custom animation and move an SKSpriteNode every frame programmatically by x += 10, will Sprite Kit still apply physics correc

2条回答
  •  爱一瞬间的悲伤
    2021-01-14 19:08

    No, you don't have to use SKAction to move SKSpriteNode. This approach works fine for me:

    - (void)update:(CFTimeInterval)currentTime {
         myNode.position = CGPointMake(myNode.position.x + 0.1,myNode.position.y);
    }
    

    All physics work as expected

提交回复
热议问题