# Distribution of solids to avoid collisions via Kangaroo

collisions.gh (9.6 KB)

Hello there! I have been trying to understand Kangaroo and I have now what seems like an easy exercise but can’t really figure out how to do it. I have attached a definition that is clearly not working. I’m looking for any recommendations of how could I achieve this via Kangaroo:

Move the cylinders within the Z-axis until there are no collisions between cylinders.

Any suggestions are welcome!

Hi Vidal,

Do you mean you want the cylinders to move up and down, so they stack on each other but stay fixed in plan?
Or you want them to all keep fixed in the z axis and move about horizontally in the XY plane so they don’t overlap?

1 Like

I’ve attached a Rhino file with two layers, one with the starting geometry and the other with what I’m trying to achieve with Kangaroo. So basically moving the cylinders up or down until no geometry is overlapping/intersecting.

Hope I can explain this right.

overlapping.3dm (1.3 MB)

I see.
Here’s one way of approaching this.

If we want them to distrubute, they can’t start all in the same plane, because then all the collision forces would be horizontal, and since they are locked in X and Y, nothing can move.

Instead I’ve started them out distributed at random vertical heights(possibly with overlaps), then pulled them towards one plane, while also including collisions between them.
cylinder_collisions.gh (21.1 KB)

One thing that helps speed up the collisions a lot here is that since nothing moves horizontally, we can check which ones overlap in plan, and only do the moving collision checks between those pairs.

Nice!! I think I understand now the logic behind the process. I wonder why I need the Triangulate component that is connected to the cylinder mesh, is it somehow more efficient? Or what is its purpose?