Game Development Reference
In-Depth Information
Figure 13-3 . Tube node z-axis rotation
BoxNode
Next you will animate the BoxNode to rotate along all three axes.
let rotation = CABasicAnimation(keyPath: "rotation")
rotation.fromValue = NSValue(SCNVector4:SCNVector4Make(0,
0, 0, 0))
rotation.toValue = NSValue(SCNVector4:SCNVector4Make(1, 1,
1, Float(2.0*M_PI)))
rotation.duration = 10
rotation.repeatCount = .infinity
boxNode.addAnimation(rotation, forKey: "rotation")
Once you have all three axes moving, the animation should look similar to Figure 13-4 .
Figure 13-4 . Box node x-, y-, z-axis rotation
Search WWH ::




Custom Search