CHAPTER 3

image

Physics Engine Basics

A physics engine is a program that provides an approximate simulation of a game world by creating a mathematical model for all the object interactions and collisions within the game. It accounts for gravity, elasticity, friction, and conservation of momentum between colliding objects so that the objects move in a believable way. For our game, we are going to be using an existing and very popular physics engine called Box2D.

The Box2D engine is a free, open source physics engine that was originally written in C++ by Erin Catto. It has been used in a lot of popular physics-based games, including Crayon Physics Deluxe ...

Get Pro HTML5 Games 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.