# Toxiclibs particle question

**URL:** <https://discourse.processing.org/t/toxiclibs-particle-question/23242>\
**Category:** Libraries\
**Created:** [August 14, 2020, 1:36am UTC](https://discourse.processing.org/t/toxiclibs-particle-question/23242 "2020-08-14T01:36:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdaein](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@cdaein](https://discourse.processing.org/u/cdaein)\
**Post date:** [August 14, 2020, 1:36am UTC](https://discourse.processing.org/t/toxiclibs-particle-question/23242/1 "2020-08-14T01:36:10Z")

</div>

Hi,  
I am trying to figure out toxiclibs `VerletPhysics2D` and `AttractionBehavior2D`.  
What I want to achieve is that use the attractor so the small particles will be attracted to the big center circle but do not go inside the shape and move around the boundary of the big circle. Here is an image I captured from Box2D example (I want to create the same behavior using toxiclibs):

 ![Screen Shot 2020-08-13 at 9.29.42 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/60cc638e2afac252bb80018b8d030793ced0d75d.png)

And here is what I have so far using toxiclibs:

```auto
import toxi.geom.*;
import toxi.physics2d.*;
import toxi.physics2d.behaviors.*;

VerletPhysics2D physics;

Vec2D center;

void setup() {
  size(500, 500);

  physics = new VerletPhysics2D();
  physics.setDrag(0.05f);
  physics.setWorldBounds(new Rect(0, 0, width, height));

  for (int i = 0; i < 100; i++) {
    VerletParticle2D p = new VerletParticle2D(new Vec2D(random(width), random(height)));
    physics.addParticle(p);
    physics.addBehavior( new AttractionBehavior2D(p, 20, -1, 0.01) );
  }

  center = new Vec2D(width/2, height/2);
  AttractionBehavior2D ab = new AttractionBehavior2D(center, 200, 1, 0.01);
  physics.addBehavior( ab );
}

void draw() {
  background(200);

  physics.update();

  ellipse(center.x, center.y, 100, 100);

  for (VerletParticle2D p : physics.particles) {
    ellipse(p.x, p.y, 10, 10);
  }
}

```

Here is the screenshot. I would like the small particles to be around the boundary of the big circle:

 ![Screen Shot 2020-08-13 at 9.35.04 PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8628563ab3fb14d6472095620f0e559c09346228.png)

Thank you for any help and guidance!
