Author: Zsófia Ruttkay Version: 1.0 Date: 25.2.2009
In the previous section we orchestra ted motion by directly defining and generating the speed. We used some functions and noise to mimic the observed motions, but did not bother about their causes. In nature it is some force which makes things move: gravitation, the force of wind, the muscle force of animals,... The living organs are more or less elastic, force also changes their shape.
There are hundreds of computer graphics articles and softwares written to simulate e.g. hair, or fluids, or the human muscles. We shall not dig into any of these - but learn about three basic principles. Using the laws of Newton will allow you to create smooth falls, bounces, glides ... and your own special effects with particles. By understanding the working of springs , you can use the principle to create elastic creatures and smooth reactive motions. Finally, creatures - from ants to birds - often move around in groups. Using artificial 'social forces' is the basis to simulate flocking behaviour .
Bouncing balls - gravity, collision and friction
Dropped ball falling and bouncing back
| change of speed by gravity bouncing without friction | |
Ball shot with some initial speed
Gravity makes the ball fall down, the x-directional speed makes it move forward. When hitting the wall, the x-speed direction changes, but not the amount - no friction thus. | change of speed by gravity bouncing without friction | |
Shooting upwards a single ball
With random initial x and y directional speed (printed), force only gravity.Trace of fall is shown. src: CourseSketches/Physics/Fall3m/Fall3m.pde Shooting upwards 100 balls at once
| loop(), noLoop(), reinitializing variables by mouse click | |
Balls bounce and roll on ground
Once the y speed is 0, the x speed keeps the balls rolling on the ground - with friction slowing them down to stop. | change of speed by gravity bouncing without friction |
Springing
Spring pulls an object
Once the mouse is released, the red stretched spring pulls the parcel to the target location. | spring physics | |
Spring pulls an object with mass
m is the mass of the object (seen by size too). Experiment with the effect of the mass on the spring's pulling force, and thus the motion. | spring physics | |
Balls connected by springs - a worm moving
Each small spring is pulled by the previous one. The chain of forces causes a worm-like motion. Experiment with changing the characteristics of the connecting springs - each instance of the Spring2D class. | Class strings stretched in any direction | |
A worm wondering around
Explore this worm example from Greenber's book. src: CourseSketches/Springs/Greenberg_11_12_Worm/Greenberg_11_12_Worm.pde | Class | |
A creature with soft deformable body
Frame of the body is a pentagonal skeleton of springs. src: CourseSketches/Springs/Greenberg_11_15_SpringyDude/Greenberg_11_15_SpringyDude.pde | |
Flocking
Pond - Synthesis_14
Small fish as boids swim around, form groups, avoid the big fish, get disturbed by mouse click, ...Coding of such behaviour simulation is beyond this course's scope - but understanding the principles and experimenting with it is not. | Class boids, steering rules, Bezier splines |
On-line learning resources
Daniel Shiffman's page on steering with examplesFurther links
Bouncing back from non-horizontal ground examples at the processing site (also in local Examples)Bouncing back from bumpy ground example at the processing site (also in local Examples)
Bouncing bubbles example at the processing site (also in local Examples)
Spring examples at the processing site (also in local Examples)
Sodaplay - highly recommended Flocking example at the processing site (also in local Examples)
Simple particle system example at the processing site (also in local Examples)
Smoke particle system example at the processing site (also in local Examples)
Smoke example at the processing site (also in local Examples)