Physics Engines Worksheet

Basic Exercise

download and install the trier physics engine for Processing:

http://www.cs.princeton.edu/~traer/physics/

See the Processing Libraries page if you don’t know how to install a library:

http://processing.org/reference/libraries/

Read the documentation on the trier physics engine web page.

Download the code for the Bouncing Balls example, and get it running on your machine.

Make the following changes:

  • Get rid of the ball that follows the mouse
  • Add gravity
  • Change the code so that when you click and drag on one of the balls, it follows the mouse

Hints for the last task. The pendulum example includes code for grabbing a particle with the mouse. You will need to change it so you can tell whether you have actually clicked on a ball, and if so which one. The Processing dist method might be useful. Also, when you are dragging you will need to keep track of which ball you had clicked on.

Extensions

Modify one of the other examples on the trier physics site.

Create sodaconstructor style creature using the trier physics engine.

Create a simple physics based game using the engine.

Try out Box2D:

http://jbox2d.nfshost.com/processing/

PDF    Send article as PDF to