我有一个球体并设法旋转它。但不幸的是沿着错误的轴线。SCNVector4:在X轴上旋转
我的目标是旋转像地球沿x轴。你能帮我申请吗?
这里是我现有的代码:
let spin = CABasicAnimation(keyPath: "rotation")
// Use from-to to explicitly make a full rotation around z
spin.fromValue = NSValue(scnVector4: SCNVector4(x: 1, y: 0, z: 0, w: 0))
spin.toValue = NSValue(scnVector4: SCNVector4(x: 1, y: 0, z: 0, w: Float(CGFloat(-2 * Double.pi))))
spin.duration = 30
spin.repeatCount = .infinity
sphereNode.addAnimation(spin, forKey: "spin around")
映射在球体上的图像已经在旋转。只是在错误的方向。我没有看到imageView在你的代码中? – netshark1000
这是一个球形图像 –
可以将它应用于我的代码吗? – netshark1000