Chapter 6. 2D Optimizations

Now that we know how to check for collisions between 2D primitives, it's time to start thinking about performance. Checking for collisions between a few objects is trivial. However, when it comes to checking for collisions between hundreds, or even thousands of objects, that's going to be tricky. With so many objects, performance really starts to matter. In this chapter, we will cover topics to improve performance when checking for collisions between objects. Specifically, we will cover:

  • Containing circle
  • Containing rectangle
  • Simple and complex shapes
  • Quad tree
  • Broad phase collisions

Introduction

Optimizing 2D collisions is not a trivial task. There are several strategies for improving the speed of complex collision detection. ...

Get Game Physics Cookbook 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.