Contents

SCNScene

A container for the node hierarchy and global properties that together form a displayable 3D scene.

Declaration

class SCNScene

Overview

To display 3D content with SceneKit, you create a scene containing a hierarchy of the nodes and attributes that together represent your visual elements. Typically, you build your assets in a 3D visual editor, then assemble them into a scene using Xcode’s SceneKit Scene Editor, ready for SceneKit to render.

[Image]

To display your scene, you need to load it at runtime, then set it as the scene property of an SCNView:

guard let myScene = SCNScene(named: "MyScene") 
    else { fatalError("Unable to load scene file.") }
scnView.scene = myScene // Your app's SCNView

Creating a Scene

The simplest way to create a scene is through Xcode’s SceneKit Scene Editor. Start by importing one or more assets from a 3D editor, such as Blender. Then you adjust the positions and attributes of the assets, and set global scene properties, such as lighting environment, to compose your scene. The scene editor creates a .scn file, which you save to a .scnassets folder in the app bundle. When you build your project, Xcode optimizes the scene file for your target platform.

Topics

Creating a Scene from a File

Managing Animated Effects in a Scene

Accessing Scene Contents

Managing Scene Attributes

Exporting a Scene File

Adding Fog to a Scene

Working With Physics in the Scene

Working with Particle Systems in the Scene

Constants

Initializers

Instance Properties

See Also

Essentials