def apply( avoid_collisions=true )
return false if @disabled
l1 = @o1.springz_loc
l2 = @o2.springz_loc
h1,dx,dy = l1.distance_dx_dy(l2)
min_distance = @distance
if avoid_collisions
combined_radius = @o1.springz_radius+@o2.springz_radius
min_distance = combined_radius if min_distance<combined_radius
end
h2 = h1-min_distance
if h2<h1
r = h2/h1
dx*=r
dy*=r
end
r = @@strength_scale * @strength * 0.5
if @@use_mass
m1 = @o1.springz_mass
m2 = @o2.springz_mass
r1 = m1/(m1+m2)
r2 = 1-r1
r1 *= r
r2 *= r
else
r1 = r2 = r/2
end
@o1.move_to( l1.x+dx*r2 , l1.y+dy*r2 )
@o2.move_to( l2.x-dx*r1 , l2.y-dy*r1 )
true
end