Game Development Reference
In-Depth Information
// Optional, but nice to be turned on during developement
sceneView.showsStatistics = true
sceneView.allowsCameraControl = true
This code will get the view, and then you add the scene to the view's scene. Since you are
here, why not add
showStatistics
so you can see how well Scene Kit handles 3D
objects? You can also add
allowsCameraControl = true
so that you can manipu-
late the view using gestures. Pinching and zooming will zoom into the scene, and panning
will allow you to pan around the scene.
Now you should be able to run the project and see the spaceman in full 3D, as shown in
Figure 10-8
.
Spaceman in 3D
Listing 10-2
.
GameViewController Class Setup
class GameViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad
// Create the scene
let mainScene = createMainScene()
// Get the games main view
let sceneView = self.view as SCNView
sceneView.scene = scene