Upload index.html
Browse files- index.html +4 -4
index.html
CHANGED
|
@@ -214,11 +214,11 @@ function step(dt){
|
|
| 214 |
if(a.abs||a.childOf||c.abs||c.childOf||a.bud||c.bud||a.budding||c.budding)continue;
|
| 215 |
// protect newly split-off blobs from immediate absorption (3s grace period)
|
| 216 |
if((a.splitAge!==undefined&&a.splitAge<3)||(c.splitAge!==undefined&&c.splitAge<3))continue;
|
| 217 |
-
//
|
| 218 |
-
if(a.r<
|
| 219 |
if((a.partner&&a.partner===c)||(c.partner&&c.partner===a))continue;
|
| 220 |
const dx=c.x-a.x,dy=c.y-a.y,d=Math.hypot(dx,dy)||0.001,rs=a.r+c.r;
|
| 221 |
-
if(d<rs*0.
|
| 222 |
const va=a.r**3,vc=c.r**3,v=va+vc;
|
| 223 |
let P=vc>va?c:a,S=P===a?c:a;
|
| 224 |
const wp=P===a?va:vc,ws=S===a?va:vc;
|
|
@@ -228,7 +228,7 @@ function step(dt){
|
|
| 228 |
P.abs={child:S,t:0,rFrom:P.r,rTo:Math.min(70,Math.cbrt(v)),
|
| 229 |
cx:(a.x*va+c.x*vc)/v,cy:(a.y*va+c.y*vc)/v};
|
| 230 |
}else if(d<rs*1.04){ // gentle cohesion pull (only when nearly touching)
|
| 231 |
-
const f=(1-d/(rs*1.
|
| 232 |
a.vx+=ux*f*dt*a.r/45;a.vy+=uy*f*dt*a.r/45;
|
| 233 |
c.vx-=ux*f*dt*c.r/45;c.vy-=uy*f*dt*c.r/45;
|
| 234 |
}
|
|
|
|
| 214 |
if(a.abs||a.childOf||c.abs||c.childOf||a.bud||c.bud||a.budding||c.budding)continue;
|
| 215 |
// protect newly split-off blobs from immediate absorption (3s grace period)
|
| 216 |
if((a.splitAge!==undefined&&a.splitAge<3)||(c.splitAge!==undefined&&c.splitAge<3))continue;
|
| 217 |
+
// allow even tiny droplets to be absorbed so they don't float forever
|
| 218 |
+
if(a.r<5||c.r<5)continue;
|
| 219 |
if((a.partner&&a.partner===c)||(c.partner&&c.partner===a))continue;
|
| 220 |
const dx=c.x-a.x,dy=c.y-a.y,d=Math.hypot(dx,dy)||0.001,rs=a.r+c.r;
|
| 221 |
+
if(d<rs*0.40){
|
| 222 |
const va=a.r**3,vc=c.r**3,v=va+vc;
|
| 223 |
let P=vc>va?c:a,S=P===a?c:a;
|
| 224 |
const wp=P===a?va:vc,ws=S===a?va:vc;
|
|
|
|
| 228 |
P.abs={child:S,t:0,rFrom:P.r,rTo:Math.min(70,Math.cbrt(v)),
|
| 229 |
cx:(a.x*va+c.x*vc)/v,cy:(a.y*va+c.y*vc)/v};
|
| 230 |
}else if(d<rs*1.04){ // gentle cohesion pull (only when nearly touching)
|
| 231 |
+
const f=(1-d/(rs*1.06))*4,ux=dx/d,uy=dy/d;
|
| 232 |
a.vx+=ux*f*dt*a.r/45;a.vy+=uy*f*dt*a.r/45;
|
| 233 |
c.vx-=ux*f*dt*c.r/45;c.vy-=uy*f*dt*c.r/45;
|
| 234 |
}
|