O'Reilly logo

Learning Three.js: The JavaScript 3D Library for WebGL by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Material properties

Let's begin with an explanation of the example. When you open up example 02-material-properties.html you'll see an empty box somewhat similar to the previous example. This box is rotating up and down around its x-axis. In the menu at the top right you've got a couple of sliders that can be used to change a couple of Physijs properties. These properties apply to the cubes and to the spheres that you can add with the addCubes and addSpheres buttons. When you click on the addSpheres button, five spheres will be added to the scene and when you click on the addCubes button, five cubes will be added, as shown in the following screenshot:

This example allows you to play around with the restitution and friction properties that you can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required