Game Development Reference
In-Depth Information
Figure 14-2 . Scene Kit render cycle
For you to receive these delegate notifications, you will need to add SCNSceneRen-
dererDelegate to your class declaration.
class GameViewController: UIViewController,
SCNSceneRendererDelegate {
Now that you have the delegate, you need to assign it to an object that will handle the
functions. In this case, you will use the GameViewController self as the delegate.
Add the following line of code in the viewDidLoad() function after the sceneView
is declared:
sceneView.delegate = self
You need to create some class-level variables that you will use throughout the
GameViewController class. Add these variables right after the class declaration line,
as shown here:
var spotLight: SCNNode!
var cameraNode: SCNNode!
var spaceManNode: SCNNode!
Writing the Callback Delegate Function
Search WWH ::




Custom Search