Orbit
This is a simulation of planets orbiting around the sun.
The physics is really simple. All planets are attracted to the sun and because of that, they orbit.
d: Distance to the sun. p: Position of the planet (vector). n: Normalized position. f: Velocity of the planet (vector). C: Kind of the mass of the sun. d = |p| n = p / d f += -n * 1/(d*d) * C p += f
When the program starts, many planets are spread around the sun with a random velocity. The physics is updated many times. If a planet flies too far away or flies into the sun, the program removes it. Now, only orbiting planets are left. The program then draws the planets and updates the physics at a human-friendly rate.
Status | Released |
Category | Other |
Platforms | HTML5 |
Author | max_hoff |
Genre | Simulation |
Leave a comment
Log in with itch.io to leave a comment.