Game Physics JS: Rigid body physics engine

Overview

1) The rigid bodies keep track of their position, movement, mass.

2) Forces can be applied to them.

class World { RigidBodies; constructor(RigidBodies){ this.RigidBodies = RigidBodies; } startFrame(){ for(var b of this.RigidBodies){ b.clearAccumulators(); b.calculateDerivedData(); } } integrate(duration){ for(var b of this.RigidBodies){ b.integrate(duration); } } runPhysics(duration){ // TODO: apply forces this.integrate(duration); } }

Using the engine

Two demos are shown:

- Flight simulator (no collisions, uses an aerodynamic tensor, see p.265).

- Sailing simulator (no collisions, uses buoyancy, see p.273).



Next