Repelling closed polylines


I am trying to have closed polylines repelling each other inside a boundary rectangle. For that I was planning to sample a certain amount of equidistant points along the polylines and set a repulsive force for each of them.

The problem is that the Kangaroo solver seems to process each polyline individually and thus appears to ignore/skip the repelling forces between them: vertices are repelling other vertices belonging to the same curve but not the ones from another curve.

Also, I don’t know how to set the solver so that these objects rightly collide on the boundary rectangle surrounding them.

Would love some help !

Test repelling (13.2 KB)

It looks like you need to flatten the Points input to the collider. This lets it process them all together as one list instead of lots of separate lists.
As for keeping them all in a rectangle, you can use an OnMesh goal with a mesh of a single quad face. If you want there to be a border, you can inset your outer rectangle by the desired amount.

1 Like

See also the example here

1 Like

Thank you so much for the prompt reply, it helped a lot !

1 Like