/** * Non-orthogonal Collision with Multiple Ground Segments * by Ira Greenberg. * * Based on Keith Peter's Solution in * Foundation Actionscript Animation: Making Things Move! */ Orb orb; PVector gravity = new PVector(0,0.05); // The ground is an array of "Ground" objects int segments = 40; Ground[] ground = new Ground[segments]; void setup(){ size(640, 360); // An orb object that will fall and bounce around orb = new Orb(50, 50, 3); // Calculate ground peak heights float[] peakHeights = new float[segments+1]; for (int i=0; i