rotateToAngle 的精灵锚点
sprite anchor point for rotateToAngle
在 sprite kit 中,如何从中心以外的位置旋转 sprite?改变它的锚点和这个有什么关系吗?
我正在使用一个动作来执行旋转:
let action = SKAction.rotateToAngle(1, duration: 0.1, shortestUnitArc: true)
node.runAction(action)
是的,您需要更改 anchorPoint
。 anchorPoint
的 x 和 y 可以从 0
到 1
变化,这张来自 Working With Sprites 的图片应该有助于解释:
在 sprite kit 中,如何从中心以外的位置旋转 sprite?改变它的锚点和这个有什么关系吗?
我正在使用一个动作来执行旋转:
let action = SKAction.rotateToAngle(1, duration: 0.1, shortestUnitArc: true)
node.runAction(action)
是的,您需要更改 anchorPoint
。 anchorPoint
的 x 和 y 可以从 0
到 1
变化,这张来自 Working With Sprites 的图片应该有助于解释: