Gravity Simulation

A Brief Explanation of What is Happening

Each of these particles is a point mass in a vacuum, they all exert a gravitational pull on each other. All of the starting positions are random, so it will take some time for the system to come to a stable state. There are some floating point issues, but otherwise the system conserves energy, and will continue to move permanently.

It won't always happen, but I find it really cool that this simple simulation will still get orbiting bodies occasionally. If you give it a few tries and look closely you might be able to find one.

This system of 3d is something I started building out a long time ago, and that I discuss more in my post about making 3d graphics in raw JS

Feb, 2019