To make it run I had to add 2D to the second import and add a third one:
from toxi.physics2d.behaviors import AttractionBehavior2D
the replace AttractionBehavior
with AttractionBehavior2D
.
Question: why the following -2 and -1?
physics.springs.get(i).setRestLength(collection[-2].radius + collection[-1].radius + 4)
Wouldn’t that reduce the rest length of all springs to that of the smallest shapes?