Adding Feet for Walking

For the feet, we’ll again use spheres of size 50. I’ll leave it up to you to figure out how to add the relevant lines of code.

Some hints:

  • Don’t move the feet left/right as far as we did the hands. The feet should be underneath the body.

  • You’ll have to move them down. The up/down positioning is done with the Y direction instead of the X direction. With leftHand.position.set(150, 0, 0), we set the X position to 150. We want to change the second number too. 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 added before rendering the scene as well.

Here is how ...

Get 3D Game Programming for Kids, 2nd Edition 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.