class Particle { private PVector pos; private PVector v; public Particle( PVector pos ) { this.pos = pos; this.v = new PVector( 0,0,0 ); } public Particle( PVector pos, PVector v ) { this.pos = pos; this.v = v; } void update() { if ( pos.y < 58 ) { pos.add(v); v.y += 1; } else { v.mult( 0.3 ); v.y = -v.y; pos.add(v); } } void draw() { pushMatrix(); translate( pos.x, pos.y, pos.z ); box(2); popMatrix(); } }