Setting the Scene

To do anything in 3D programming, we need a scene. Think of the scene as the universe in which all of the action is going to take place. For something so important, it’s really easy to create. The following code in ICE does just that:

 
// This is where stuff in our game will happen:
 
var​ scene = ​new​ THREE.Scene();

Scenes are really simple to work with. We’ve been adding objects to them throughout the book. Once things have been added to a scene, it’s the scene’s job to keep track of everything. In fact, that’s pretty much all we need to know about scenes—after creating one, we add lots of stuff to it and the scene takes care of the rest.

Get 3D Game Programming for Kids now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.