Thing t; Attractor a; boolean showVectors = true; void setup() { size(900,400); framerate(30); background(0); colorMode(RGB,255,255,255,100); Vector3D ac = new Vector3D(0.0,0.0); Vector3D ve = new Vector3D(0.0,1.0); Vector3D lo = new Vector3D(50,50); t = new Thing(ac,ve,lo,1); a = new Attractor(new Vector3D(width/2,height/2),20,0.4); } void draw() { background(0); smooth(); a.rollover(mouseX,mouseY); Vector3D f = a.calcGravForce(t); t.add_force(f); t.go(); a.go(); } void mousePressed() { a.clicked(mouseX,mouseY); } void mouseReleased() { a.stopDragging(); } void keyPressed() { showVectors = !showVectors; } void drawVector(Vector3D v, Vector3D loc, float scab) { if (v.magnitude() > 0.0) { pushMatrix(); translate(loc.x,loc.y); stroke(255); rotate(v.heading2D()); float len = v.magnitude()*scab; popMatrix(); } }