Using Cameras to Capture the Scene

Scenes do a great job of keeping track of everything, but they don’t show us what’s happening. To see anything in the scene, we need a camera. Notice the following code in ICE:

 
// This is what sees the stuff:
 
var​ aspect_ratio = window.innerWidth / window.innerHeight;
 
var​ camera = ​new​ THREE.PerspectiveCamera(75, aspect_ratio, 1, 10000);
 
camera.position.z = 500;
 
scene.add(camera);

The purpose of the aspect_ratio is to determine the shape of the browser. This is the same thing as aspect ratios for movie screens and TV sets. A large TV with a 4:3 aspect ratio might be four meters wide and three meters tall (OK that’s a really large TV). An even larger 4:3 screen might be twelve meters wide and nine ...

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.