3D Game Programming

(C. Jardin) #1
varcover =newTHREE.MeshNormalMaterial();
varbody =newTHREE.SphereGeometry(100);
varavatar =newTHREE.Mesh(body, cover);
scene.add(avatar);

varhand =newTHREE.SphereGeometry(50);

varright_hand =newTHREE.Mesh(hand, cover);
right_hand.position.set(-150, 0, 0);
scene.add(right_hand);

varleft_hand =newTHREE.Mesh(hand, cover);
left_hand.position.set(150, 0, 0);
scene.add(left_hand);

varfoot =newTHREE.SphereGeometry(50);

varright_foot =newTHREE.Mesh(foot, cover);
right_foot.position.set(-75, -125, 0);
scene.add(right_foot);

varleft_foot =newTHREE.Mesh(foot, cover);
left_foot.position.set(75, -125, 0);
scene.add(left_foot);

This is everything after START CODING ON THE NEXT LINE.


3.5 Challenge: Make the Avatar Your Own


If you’re up for a challenge, see if you can create an avatar that looks some-
thing like this:

To make this, you need to replace the body with one of the shapes from
Chapter 1, Project: Creating Simple Shapes, on page 1, and add a head. Don’t

report erratum • discuss

Challenge: Make the Avatar Your Own • 31


Prepared exclusively for Michael Powell

Free download pdf