Applying two forces to particles

Hi,

I’m writing a sketch where I want many small particles to be attracted to large central particle, this is working.
However I also want all small particles to repel from each other at the same time.

I’ve tried a couple of things and am getting erratic results.

here’s the: https://codepen.io/jmean/pen/Eebzvq if anyone’s willing to give me any pointers.

Thanks

You may want to check out this Particle Attraction and Repulsion Forces Tutorial - https://www.youtube.com/watch?v=OAcXnzRNiCY

1 Like