I would like to create spheres with “electric charges” such that they would repel if they are the same charge and attract if opposite. I haven’t found a way to do this with the CannonJS API and was wondering if anyone had some ideas.
Ideally, I would like to add a function to the physics engine called on every update that:
- determined the effective “electric field” caused by the particles as a function of space
- and from that determine for each sphere the force felt by that sphere in response to that field.
Thanks for you help!