         p.x = mod(p.x + random * 10.0, worldsize.x);
     }
     if (length(obstacle) > 0.5) {
-        if (length(v) < 0.5) {
-            p.y += worldsize.y; // dislodge
-            p.x += random;
-        } else {
-            p.x -= v.x * 2.0;
-            p.y -= v.y * 2.0;
-        }
+        p -= v;        // back out velocity change
+        p += obstacle; // push out out obstacle
     }
 }
 

        v.y = 0.0;
    }
    if (length(obstacle) > 0.5) {
        v = reflect(v, obstacle) * 0.20;
    }
}



const float BASE = 255.0;
const float OFFSET = BASE * BASE / 2.0;
const float RESTITUTION = 0.25;

float decode(vec2 channels) {
    return (dot(channels, vec2(BASE, BASE * BASE)) - OFFSET) / scale;
