Concept
For the midterm I decided to go back to space theme like I did in assignment 3. I really liked the design of the planets I came up with and wanted to possibly further explore that design with adding particles as an addition. I want again to use the planets as attractors but I would like to explore the idea of using the particle systems as little particles in space that go around these planets and make different constellations like Saturn’s ring.
Implementation
-
Background atmosphere
-
Stars placed in the background randomly.
-
A starfield with subtle twinkling for texture and scale.
-
-
Planet body
-
A solid planet drawn with shadows and rings to give depth.
-
-
Ring particle system
-
Each particle is assigned a target ring radius (three radius “bands”).
-
Motion is driven by a combination of forces:
-
Inward pull (gravity-like) to keep particles bound to the planet.
-
Tangential swirl to create orbit motion.
-
A spring force that pulls particles back toward their target radius so the ring stays structured.
-
-
Light damping/drag to keep it smooth and stable.
States/variation
At this point in time I still don’t have multiple states of the sketch, I am still thinking about what I could make different exactly for now some ideas were either placing different kinds of planets that have varying gravitational pull or removing the planets to create galaxy like objects. Or potentially giving an option to add multiple planets.
Scary parts
Right now the scariest part was actually making the particles go in a circle around the planet. I achieved this by doing the following:
First I calculate the vector pointing from a particle to the planet
let toCenter = p5.Vector.sub(planet.pos, p.pos); let d = max(toCenter.mag(), 1); toCenter.normalize();
After which I create a tangential force which actually gives the particles the circular motion
let tangential = createVector(-toCenter.y, toCenter.x); tangential.mult(0.22 * planet.spin); p.applyForce(tangential);
I also added some pull to keep the particles from going away
let grav = toCenter.copy().mult(0.14 * planet.massScale / (1 + d * 0.006));
And that’s how I created the ring around the planet. I am just a little worried if making the galaxy style sketch would bring more complexity to the design and if I will need to use something different for the particle movement.