This week’s topic was Forces and simulating forces in the Processing environment. The main content from now on will come from “The Nature of Code” as I have finally learned all of the basics to the language and I am finally making particle simulations. The downside is that now things are more complex and even though I was able to swift through a lot of the preliminary content, I am finding myself getting stuck a lot more.
In any case, let me give a brief run on the forces that we looked at in Chapter 2 of “The Nature of Code”. We now have the PVector class that we know how to use so we can begin to use Physics to model motion under acceleration. Since Processing’s basic unit is a pixel, the distance units become pixels and the velocity units become pixels per frame. The chapter gave me a brief intro into classical mechanics with Newton’s Laws. We looked at gravitational force, friction forces and drags. But these end up being an approximation. The world we are simulating in Processing doesn’t really stand a chance against more sophisticated physics algorithms. Instead, what we should strive to do with simulations is to make them “look” like they are something.
For this weeks project I incorporated forces into the Particle String composition from week 7. This took me a long time to get right. Rather than use a force as described in the book, I decided to make up a force that would the particles stick to the sides of the window. The result feels like a viscous fluid splattering inside a box. Notice that if you keep the left mouse button pressed as you move your cursor around, the particles create a string, almost like a snake that follows the cursor. This was accomplished by incrementally setting up the the limiting velocity for each particle. The composition can be seen here.