Chapter 10Project: Collisions

When you’re done with this chapter, you will

  • Be able to stop game elements from moving through each other

  • Understand collisions, which are important in gaming

  • Have game boundaries for your avatar

We have a pretty slick game avatar. It moves, it walks, it even turns. But you may have noticed something odd about our avatar. It can walk through trees.

images/collisions/stuck_in_a_tree.png

In this chapter we’ll use tools that are built into our Three.js 3D JavaScript library to prevent the avatar-in-a-tree effect. (As we’ll see in other chapters, there are other ways to do the same thing.)

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.