-
Book Overview & Buying
-
Table Of Contents
Learn Three.js - Fourth Edition
By :
In this section on basic 3D geometries, we’ll start with a geometry we’ve already seen a couple of times: THREE.BoxGeometry.
THREE.BoxGeometry is a very simple 3D geometry that allows you to create a box by specifying its width, height, and depth properties. We’ve added an example, box-geometry.html, where you can play around with these properties. The following screenshot shows this geometry:
Figure 5.9 – Basic 3D box geometry
As you can see in this example, by changing the width, height, and depth properties of THREE.BoxGeometry, you can control the size of the resulting mesh. These three properties are also mandatory when you create a new cube, as follows:
new THREE.BoxGeometry(10,10,10);
In the example, you can also see a couple of other properties that you can define on the cube. The following list explains all the properties:
width: This is the width of the cube. This...