I’m a Hifi intern for the summer working on a project to create a virtual physics classroom to simulate planets orbiting around the sun.
Here is a rough version of the script I’m working on:
The script uses orbital physics formulas to update the position and velocity of planets, and traces their orbital path around the sun (using line entities). I’ve added UI sliders (adapting the cookies.js script) to allow for some experimentation with adjusting the gravitational force (G) and the orbital period (T). It also contains a function that calculates the total energy of the system and readjusts the velocity to bring the energy back to its initial value; this keeps the orbits from deviating from a circular path.
Have a look at the script and feel free to let me know if you have any suggestions for improvement or for the overall direction of the project.