Skip to content
Daniel Shiffman edited this page Feb 5, 2019 · 34 revisions

Assignment: Choose one or create your own.

  • Rework your motion sketch from week 1 using vectors (PVector in Processing, p5.Vector in p5). Try incorporating the concept of forces into the environment by affecting only the acceleration. Create a formula for calculating a dynamic acceleration, one that changes over time based on any number of factors. What happens if you make more than one object via an array.
  • Using forces, simulate a helium-filled balloon floating upward (and bouncing off the top of a window). Can you add a wind force which changes over time, perhaps according to Perlin noise?
  • Create an example where instead of objects bouncing off the edge of the wall, an invisible force pushes back on the objects to keep them in the window. Can you weight the force according to how far the object is from an edge, i.e. the closer it is, the stronger the force?
  • Create pockets of air resistance / friction in a p5 sketch. Try using circles instead of rectangles, i.e. pockets of mud (or ice). What if you vary the strength (drag / friction coefficient) of each circle? What if you make some of them the opposite of drag—i.e., when you enter a given pocket you actually speed up instead of slow down?
  • Research a force not covered in class and implement it as a vector.
  • Use the concept of forces to visualize some input (could be data, literal example would be get windspeed online and translate to a wind force in p5, but feel free to think more abstractly)
  • Build a sketch that has both "Movers" and "Attractors". What if you make the Attractors invisible? Can you create a pattern / design from the trails of objects moving around attractors? See the Metropop Denim project by Clayton Cubitt and Tom Carden for an example. I also made this p5.js coding challenge video and corresponding source code which you could use as a starting point.
  • Model the terminal velocity of a cat.

Directions

  • Document your work on the web and link to it below.
  • Try to post by 10am the day of class if at all possible.
  • Add a question below!

Questions

  • your question here -- your name (optional)
    • an answer will appear here
  • Going through this example I don't understand the purpose behind using p5.Vector in the update function rather than a createVector function. What are the functional differences between the two methods? Is one a local and the other a global variable? Or does one variable last perpetually, while the other is a momentary instance? -- Sam
  • Can we talk a little about elastic collisions? A ball/particle colliding with an immoveable object is pretty simple, but when there's mass and velocity involved, the math gets a little intense and then translating that math into code is getting difficult. -- Lucas
  • I followed along with this example in which acceleration is reset & re-calculated each frame. I am trying to adapt the fleeing function to model wind blowing sand away, in which it takes time for wind to overcome each grain's friction and only then do they accelerate. I am having trouble understanding how to have a force increase over time (so that it can overcome friction). I am generally a bit confused about how we understand time as defined by frame rate....
  • A short description about these syntaxes: acceleration.mult(0); gravity.mult(n.mass); Also what is the general strategy for using a default number in formula? like 1 to Normal force -Zohreh

Post your work

Clone this wiki locally