HTML and CSS Reference
How Does Box2dWeb Work?
Box2dWeb is a physics modeling engine. It allows a developer to create a world with physics
properties and add objects to that world that react to the properties of that world and to each
other. However, the world is not displayed (not formally anyway, as you'll see in a bit). The
job of the Canvas developer when using Box2dWeb is to define a physics model and then ap-
ply it to the Canvas.
Before we get started, here are some definitions in Box2dWeb related to the examples we are
going to cover. (The World modeled with Box2D is more complicated than just this, but these
are the things we will cover in the examples.)
A geometrical object that exists 2D space. These are circles, squares, rectangles, and so
A logical object that binds a shape to body and give it properties like density, friction, and
A physical manifestation of an object in the 2D world, with a fixture and a shape applied.
A 2D physics world that contains bodies that react to one another
In the examples that follow, we will show how these things relate to one another in Box2D.