Tôi có SKShapeNode (hình chữ nhật trong trường hợp này) mà tôi đang cố xoay dọc theo tâm của nó. Tuy nhiên nó đang xoay dọc theo điểm dưới cùng bên trái của màn hình. Vì tôi không thể thiết lập một điểm neo cho SKShapeNode, làm thế nào tôi có thể đạt được yêu cầu của mình (để xoay hình dọc theo tâm của nó). Đây là mã tôi đang cố gắng.Xoay SKShapeNode dọc theo chính giữa
let rectangle = SKShapeNode()
rectangle.path = UIBezierPath(rect: CGRectMake(view.frame.width/4, view.frame.height/2, view.frame.width/2, view.frame.width/2)).CGPath
rectangle.fillColor = UIColor.yellowColor()
rectangle.strokeColor = UIColor.yellowColor()
let oneRevolution = SKAction.rotateByAngle(360, duration: 100.0)
let repeat = SKAction.repeatActionForever(oneRevolution)
rectangle.runAction(repeat)
đã khắc phục câu hỏi. –