Hello! I’m Bridget, and I’ve been interning at High Fidelity this summer, working to build some JavaScript content in HF. As a math and computer science major, I had the opportunity to hone my programming skill set, learning from Hifi’s superb team of software engineers and design-minded innovators.
So here’s the culmination of my work this summer: a virtual orbital physics simulation that provides an immersive, interactive look at our solar system.
The goal: demonstrate what can be built with the JavaScript API, while experimenting with the potential for building educational content in High Fidelity. This project was excellent exposure to coding in JS (as well as some C++), and a very cool glimpse into the many capabilities of building for a virtual reality platform.
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², 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 cell science — 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!