我正在使用以下代码来使Sprite节点在Xcode spritekit中的圆圈中移动。Sprite节点的起始位置
let circleDiameter = CGFloat(100)
// center our path based on our sprites initial position
let pathCenterPoint = CGPoint(
x: object.position.x - circleDiameter,
y: object.position.y - circleDiameter/2)
// create the path our sprite will travel along
let circlePath = CGPath(ellipseIn: CGRect(origin: pathCenterPoint, size: CGSize(width: circleDiameter, height: circleDiameter)), transform: nil)
// create a followPath action for our sprite
let followCirclePath = SKAction.follow(circlePath, asOffset: false, orientToPath: false, duration: 3)
// make our sprite run this action forever
object.run(SKAction.repeatForever(followCirclePath).reversed(), withKey: “moving”)
world.addChild(object)
问题是,精灵节点的起始位置总是位于圆形路径的右侧。我知道我可以使用.reversed()来改变精灵节点的方向,但这不是我所要求的。
如何将“起点”更改为圆形路径的左侧?
谢谢!请参考下面的图:d
[开始的可能的复制和UIBezierPath的结束角度?](https://stackoverflow.com/questions/32165027/start-and-end-angle-of-uibezierpath) –