Planets.js script


#1

Hi everyone,

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:
https://hifi-staff.s3.amazonaws.com/bridget/orbits.js

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.

Thanks,
Bridget


#2

Looks great! I don’t know the scope of the simulation, but it would be awesome to see the orbits off the ecliptic as shown here as well as elliptic orbits, though that gets tougher to model:


#3

Thanks @Balpien_Hammere ! It would be cool to have an option to toggle between elliptical/circular orbits. I like the colors/labels there, too.


#4

and add Halley’s Comet… the Solar system seems so empty without it
:slight_smile:


#5

o.o but i thought


#6

@JUDAS! You were NOT supposed to release that photo from NASA’s REAL pic of the earth!


#7

I Just had the chance to play with the orbit script, and yes i was wondering too, where the giant turtle and the elephants are in this simulation…

Whatever…It’s awesome. …very good Job…keep it on.

As you asked for it, my suggestions would be…

  • coloured trails, to make it easier to see the effect of a change in the gravital forces, and in combination with that a Legend two show which coloured trail belongs to which planet.

  • a window with some information about the planets…like…mass, current speed etc…something like that…

regards

Phineas


#8

I ran this script once and it crashed the Interface. I can no longer log on or open the program.


#9

Here’s an updated version: https://hifi-staff.s3.amazonaws.com/bridget/orbits.js

@Phineas.Click Thanks for the suggestions – I added colored trails and labels when you click the “Pause” button in the panel.


#10

You talked about that you update the entities every 10 second to keep the mass etc. correct.
In the poast when i tried to update parameters like direction etc. the entity always stopped short. DO you have that problem too ? or mabye i did something wrong months ago.


#11

Just tried the new Version…very cool…Clever idea to let the trails fade out, so that they don’t cover up the screen.
Btw…are the Planets affecting each other?..So would it be possible do simulate what would happen if you take one of them out of the equation?

…o_O…i just realised that this start to sound like a god complex…wanting to play with our solar system.:wink:

regards

Phineas


#12

For anyone familiar with Maya or Blender (@Menithal @Judas), I’d like to start to get some cloud textures on the planet models. If anyone can get this done in the next 2 days I would appreciate it!

https://worklist.net/20588


#13

Great job @bridget.went !


#14

Is it available somewhere on the web and is it still working? link provided is giving permission error and probably it is missing. :frowning: