CurveCollide: getting duplicate polygons in Kangaroo solution

Hi, I’m working with a simple example based on @DanielPiker’s “collide 2d shapes” example from his GitHub repository. I can’t find that component in the latest Kangaroo menu. Was Collide2d (C2d) rewritten and renamed to CurveCollide (CC)? Or was it meant to be a custom component?

When using the CC component, I’m getting duplicate polygons in the solution. One set seems reference each vertex in the polyline and satisfies the OnMesh goal I’m using but not the CC goal. The other references just the centroid, staying intact when grabbed and satisfies the CC goal but not the OnMesh goal.

When I use the C2d component pasted in from the Github example, the simulation behaves as expected with no duplicates.

Perhaps there’s something off in my definition… or the two components are designed for different uses? (24.5 KB)

CurveCollide is the new component, and it works with curves as rigid bodies. It only creates a single (oriented) particle for each input curve.
I removed the older Collide2d from the component menu to avoid confusion, though definitions which use it will still load and work as before. This goal only works with polylines, and additional goals are needed if you want them to preserve their shape.
I notice though that in your file the curves are circles. If you are just using circles there is a much simpler option - to use the ‘Collider’ goal, which lets you input spheres of various radii.

Here’s an example with CurveCollide on some rigid curves.
Also shown is the use of a passive curve input which doesn’t itself get affected by the collisions, though the other curves are affected by it.
To apply goals like OnPlane to the rigid curves, they need to act on the centre frame of the curve, which you can get from the F output of the component. (9.4 KB)

and here’s an example for if the curves are always circles
(if we know it’s a circle, it is much faster to calculate, since we just need to check the distance between the centres) (14.6 KB)

Good to know that Curve Collide only works with rigid bodies. Maybe that should be mentioned in the tooltip?

I do actually need the bodies to be non-rigid. The circles were just a starting point for generating them. So it looks like I’ll need to use the Collide 2D component.

Thanks for the info!

For deformable polyline curves, another way that can work is to use the Collider component on the line segments. It does require a radius for the collisions, so isn’t suitable if you need very sharp corners, but it seems to work a lot better than the old Collide2d goal (which I was never really happy with the performance of, which is partly why I hid it). I might try again at some point to make a better deformable curve collision goal not requiring a radius, but I think this Collider option is the best one for now (20.7 KB)


That looks perfect. Thank you!