Satellites in Orbit
Playing with Universal Gravitational Attraction
This is another example based on Dan Shiffman's book The Nature of Code, and his Coding Train NOC 2 youTube series; specifically episodes 2.5 and 2.6.
As with his other examples, Dan does not use real-world length or time or mass units, and basically makes up values for constants such as g and G. I will slightly improve on that in my version by at least including the real values of the constants, even if I go on to modify them with a fudge factor (which could be considered to constitute a scaling of pixels to meters or km) but I will not do a thorough real-world scaling as I do in some other projects.
In this version, I have multiple bodies orbiting a sun-like object. Any body that gets beyond the gravitational influence of the "sun" is removed from the array of satellites. The orbiting bodies do not attract each other or the sun in this version. Next step will be to have all the bodies mutually attracting each other, as an "N-body" problem.