Boxjs is a javascript 2D physics engine based off of Box2D.
Boxjs can be used both in node as well as in browser.
For a demo (WIP), check out the testbed.
1-9
.0
to toggle debug view, which draws the broadphase AABBs.This test displays basic features of the physics engine. There are examples of various shapes and joints, including a rope with a heavy load.
This test sets up a short course for a car with a motorized joint, and various obstacles.
wasd
controls to drive the carThis test demonstrates the raycast feature.
This test demonstrates the fork
feature, which is the ability of the engine to
quickly clone itself, and later “restore” the forked state.
f
to fork the solver state at the current positionr
to restore the forked state, “rewinding” time.This test creates a 10x10 stack of boxes, and times how long it takes to run 5000 steps. It logs the result to the console.
This test demonstrates “particle” support. Particles are bodies in the engine which can bounce off other bodies, but don’t themselves take up any space or impart any forces.
This test is a simulation of a one-wheeled vehicle. It uses a PID controller to translate player input to motor impulses that steer the vehicle without tipping.
wasd
controls to drive the vehicleThis test demonstrates sensor shapes. The outlined shapes are the sensors, and will change color when detecting an overlap.
wasd
controls to move the shape with the sensors around.This test demonstrates continuous collision detection. It defaults to TOI off,
t
to toggle time of impact.