假设我在SceneKit场景中有两个节点。我想让其中一个节点围绕另一个节点旋转或者轨道运动(就像行星绕着恒星旋转一样),每隔一段时间转一圈。我知道可以通过以下方式设置动画:
let anim = CABasicAnimation(keyPath: "rotation")
anim.fromValue = NSValue(scnVector4: SCNVector4(x: 0, y: 1, z: 0, w: 0))
anim.toValue = NSValue(scnVector4: SCNVector4(x: 0, y: 1, z: 0, w: Float(2 * Double.pi)))
anim.duration = 60
anim.repeatCount = .infinity
parentNode.addAnimation(aim, forKey: "spin around")
有没有“轨道”动画,并且有指定目标节点的方法?