By Tim King · Updated
Physics Sandbox
Drop Shapes, Change Gravity and Play With a 2D Physics Engine
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Physics Sandbox works
This physics sandbox drops shapes that bounce and stack. Click anywhere in the box to drop a shape and it falls, bounces off the ramps and settles into the pile. Drag any shape with the mouse to throw it, hit Rain 30 shapes to fill the box, or Shake to send everything flying. The sliders change gravity (including negative, so things float), how bouncy and how grippy the shapes are, and how fast time runs, and every change applies immediately to everything already on screen.
Physics sandbox: how it works
This is a rigid-body physics engine running in your browser, the same kind of engine that powers 2D games. Every shape has a mass worked out from its area, a velocity, and a spin, and sixty times a second the engine works out which shapes are touching, pushes them apart, and applies gravity and friction. Nothing is scripted; the pile you end up with is the result of thousands of small collisions.
Gravity. The slider is in multiples of Earth gravity as the engine sees it. At 0 the shapes drift in whatever direction they were last pushed and never stop; drag one and let go to see it glide. Negative gravity makes everything fall upwards and gather along the top edge, which is a good way to see that the ramps work in both directions.
Bounciness is the coefficient of restitution: the share of speed a shape keeps after a collision. Zero is a beanbag, one is a superball that never loses energy, and anything above about 0.8 turns a full box into a boiling pot because energy stops draining out. Real objects sit between 0.1 for wood on wood and 0.9 for a golf ball.
Friction is the grip between surfaces. At zero the ramps become ice and a box slides off them as easily as a circle; at one, boxes and planks stick where they land and can be stacked. Circles are barely affected because they roll rather than slide.
Simulation speed scales time. Slow it to 0.1 to watch a collision frame by frame, or to 2 to let a big pile settle quickly. Pause freezes the frame entirely, Save PNG captures it, and Fullscreen gives you the whole screen to play in. The engine is Matter.js, running entirely in your browser.
FAQ
What happens at zero or negative gravity?
At zero, shapes drift in whatever direction they were last pushed and never stop. Below zero everything falls upwards and gathers along the top edge, so you can see the ramps work in both directions.
Why does the box boil over when I raise bounciness?
Bounciness is the coefficient of restitution: the share of speed a shape keeps after each collision. Above about 0.8 the shapes stop losing energy fast enough for the pile to settle, so the whole box keeps churning.
Why does friction barely affect the circles?
Friction resists sliding, and circles roll rather than slide. Boxes and planks at high friction stick where they land and can be stacked; at zero the ramps become ice and everything slides off them.
Can I slow things down to watch a collision?
Set the simulation speed to 0.1 and the engine takes small steps in real time, so you can follow a bounce frame by frame. Pause freezes the frame entirely and Save PNG captures it.
See also: all Simulations & Screensavers tools, Images, Audio, Video & Screen, PDF, SVG, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, Diagram Makers, 3D Science, Tracker Music.
Related tools
Plinko Game
Drop balls down a peg board and watch the bins fill up.
Double Pendulum
Chaotic two-rod pendulum with a traced path; angle, length and speed sliders.
Falling Sand
Paint sand, water and walls and watch them settle; fullscreen.
Boids Simulation
Flocking birds from three rules, with sliders and fullscreen.
3D Dice Roller
Throw physics dice in 3D, then read every face and the total.