The rest of this chapter is dedicated to two physical simulation libraries, the Box2D (2D simulation) and Open Dynamics Engine (3D simulations). Building these is not hard, so we’ll focus on making real use of them. The APIs of Box2D and ODE only provide functions to calculate current positions of the rigid bodies in simulations. First of all, we have to call the calculation routines. Then, we have to transform the bodies’ physical coordinates into a screen-related coordinate system. Connecting physical simulation with rendering and timing is the main problem treated in this recipe.
Virtually, every rigid body physics library provides abstractions of the world, object (or body), constraint (or joint), and shape. The world here is just a collection of bodies and joints attached to bodies. Shapes define how bodies collide.
To create a dynamic application based on the physical simulation, we have to be able to render the physical scene at any moment...