3D Game Programming

(C. Jardin) #1

  • You’ll have to move them down. The up/down positioning is done with
    the Y direction instead of the X direction. This is the second number of
    right_hand.position.set(-150, 0, 0). You may have to use negative numbers to go
    down—for example, –25.

  • Recall that the hand was added before we rendered the scene—before the
    line with renderer.render(scene, camera). The feet should be as well.


Here is how we did the right hand; it might help while you try to figure out
the feet:

varhand =newTHREE.SphereGeometry(50);

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

Good luck!


Try This Yourself
Try to place the feet yourself. To move the feet left and right, you
change the first number in right_foot.position.set(0, 0, 0). To move it up
and down, you change the second number (the third number is
forward and backward).

It may take a while to get it right, but believe me—it’s good practice.
Try for a bit and then continue with the text.

Did you get it?


This is what it might look like:


Don’t worry if yours is not exactly the same. Yours may even be better!


If you’re having difficulty, refer to the code that was used to make the avatar:


Chapter 3. Project: Making an Avatar • 30


Prepared exclusively for Michael Powell report erratum • discuss

Free download pdf