Populate Geometry (global control)

Thanks :slight_smile:

It’s a goal for repulsion with a strength that’s a power of inverse distance - so strong when the points are close, falling off as they are further apart.

You could also use elastic spheres (as in the SphereCollide goal) to push things apart, but there strength is a linear function of distance with a hard cutoff, and I find that the falloff from the power law repulsion often results in a nicer distribution.

The problem with inverse distance functions though is that you end up with all points affecting all the other points, so a lot to calculate. Above some distance though, the strength gets pretty negligible if you’re using something like an inverse cube strength, so you can just ignore it with little change in the result. Then you are dealing with only local interactions and can use spatial sorting to give a big speedup.
The goal also adjusts it so that this cutoff isn’t a hard step, but blends down to zero within the given range.
There was nothing special about the value of 1.5 I chose in this example - it was just what worked to give a good distribution here. A value for range that is enough so that each point interacts with its neighbours and their neighbours is usually enough to give a nice result, and going higher just slows things down without much benefit.

The C# should work without modification anywhere you have points you want to push apart.
I’ll probably make it a standard included Kangaroo goal component soon, I was just refining it a bit.
I’ve also posted some other definitions using this goal or slight variations on it here:

4 Likes