Summary

In this chapter, we have gone from a simple demonstration of a ball bouncing off a vertical wall to creating complex simulations involving particles bouncing off multiple inclined walls and particles colliding with other particles. We have covered the underlying physics in considerable detail, discussing the equations that govern different types of collisions in 1D and 2D. In implementing collision resolution, both with walls and between particles, we introduced a novel method using vector algebra that avoids the usual need for performing coordinate rotations to resolve collisions in 2D.

Get The Essential Guide to Physics for Flash Games, Animation, and Simulations 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.