The simulation uses real gravitational physics to simulate planets in orbit around a sun. The planets are positioned at a set radius from the sun, each radius scaled accurately relative to earth. I fix reference values for the orbital period, large and small body masses, and gravity (not equivalent to the universal gravitational constant). Then, using GM/r^2, I compute the acceleration necessary to keep each planet in a stable orbit. Abiding by equations of orbital motion, the script updates the motion of each planet to mimic its orbital trajectory about the sun. Their paths are traced using line entities (a relatively new system feature).
While the simulation exploits a somewhat simplified model, namely neglecting the elliptical nature of the planets' orbits, it can easily be modified to account for additional factors such as the n-body problem.
Similar to cellscience--the virtual cell classroom which Ryan and co. have built--the solar system simulation offers an interactive model that could be used by educators--in a high school physics classroom, for example--to demonstrate gravity and orbital physics.
Another fun aspect of the project was implementing UI to create possibilities for exploration and experimentation within the simulation. A panel with icons lets you:
- Pause the simulation and show labels above each planet revealing its name and current speed
- Zoom in on each planet
- Play a "Satellite Game" (think Lunar Lander, but with a satellite around the earth), where you attempt to fling a satellite into stable orbit
- Adjust gravity and/or the "reference" period, and see what happens!
Here's the script.