/* A basic vector example. The end result should be a bouncing square. */ SimObject so; void setup() { // setup the screen size(500, 500); background(0); // create acceleration, velocity and location that our object starts with Vector2D a = new Vector2D(0.0,0.0); // no initial acceleration Vector2D v = new Vector2D(0.0,0.0); // no initial velocity Vector2D l = new Vector2D(250,10); // starts at the top center of the screen // create our object so = new SimObject(l, v, a, 1.5); } void draw() { // clear the screen background(0); // create some gravity as a vector pulling towards the bottom of the screen Vector2D gravity = new Vector2D(0, 0.9); so.addForce(gravity); // let our object animate itself so.simulate(); }