liabru / matter-attractors

an attractors plugin for matter.js
MIT License
149 stars 31 forks source link

Can this be used to even distribute particles inside an area? #8

Open trusktr opened 6 years ago

trusktr commented 6 years ago

I have a spherical area, and I'd like for particles to naturally distribute themselves somewhat evenly inside the area.

Could I possibly use Matter's gravity along with this to somehow make them want to distribute themselves evenly inside the area?

probityrules commented 6 years ago

I think it could be a good match, but you'd probably need to make your own attractor / repeller function since you would essentially need to strongly repel near objects and the spherical area's edge and (maybe?) slightly attract far objects. That said, the included attractor gravity function with negative gravity might do what you want.