Physics Simulation

Information

These simulations were created as a very basic demonstration of simple physics. Largely inspired by Daniel Shiffman's Nature of Code book.

Disclaimer: These simulations are not meant to be perfectly accurate. Measurements are not based on real world units, but instead pixels and frames per second. In addition, energy is not completely conserved due to small rounding errors, which tend to build up over time. Do not be surprised if objects behave strangely when affected by gravity at extremely close ranges.

Controls

Key Description
Spacebar Resets the simulation.
B Spawns a bouncy ball at the location of the mouse.
(Bouncy ball simulation only)
P Spawns a planet at the location of the mouse.
(Gravity simulation only)
R Resets all velocities to 0.
S Spawns a star at the location of the mouse.
(Gravity simulation only)
V Toggles the variable editor.
X Updates variables.