BlackHole

Gravitation

max = 10;
gravity = .006;

dx = -pa.x;
dy = -pa.y;
dz = -pa.z;

//dist = Math.sqrt(dx*dx + dy*dy + dz*dz);
//dsg = dist * dist * gravity;

dsg= (dx*dx + dy*dy + dz*dz) * gravity;

pa.vx += dx / dsg;
pa.vy += dy / dsg;
pa.vz += dz / dsg;

pa.vx = (pa.vx > max) ? max : ( (pa.vx < -max) ? -max : pa.vx );
pa.vy = (pa.vy > max) ? max : ( (pa.vy < -max) ? -max : pa.vy );
pa.vz = (pa.vz > max) ? max : ( (pa.vz < -max) ? -max : pa.vz );

pa.x += pa.vx;
pa.y += pa.vy;
pa.z += pa.vz;