Making a Whole from Parts
From Chapter 1, Project: Creating Simple Shapes, we already know how to make basic shapes. Let’s start building our player avatar by making a sphere for the body.
| var cover = new THREE.MeshNormalMaterial(); |
| var body = new THREE.SphereGeometry(100); |
| var avatar = new THREE.Mesh(body, cover); |
| scene.add(avatar); |
We already know what happens when we type that in—we get a ball in the center of the scene.
Let’s add a hand next to the body. Add the following lines below the code that you already entered to create the body.
| var hand = new THREE.SphereGeometry(50); |
| |
| var right_hand = new THREE.Mesh(hand, ... |
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.