And a video
pigment video orbit physics gravity
This is a quick video I made of the spheres moving about and gravitating with each other.
I think in my next journal article (not tonight I'm afraid, I'm bogged down with tons of real-life work) I'll go into how I'm calculating them all. For the impatient I'm essentially using Barnes-Hut with my own implementation of an Octree. Each item performs pairwise gravity calculations which each other item in the octree node (each node has a capacity of items, I've set it to 3 currently) and then performs pairwise gravity calculations with the surrounding nodes themselves. The nodes accumulate the total mass of their children, so as to be a rough estimate for the amalgamation of gravitational forces in that region. This means that, roughly speaking, each item gravitates with every other item.
And lo and behold, the video:
Bear in mind, I've artificially forced the spheres to be much closer together than they would be in real life (space, if you might know if you recall your Adams, is big. Really big), this is so that their motion is noticeable.
I'll talk about some of the issues present in the video (such as motion stuttering, a couple of LOD meshes with inverted normals and a bit of flickering here and there) in the next journal entry too, rest assured - I am aware of them.