VerletPhysics: addForce != addVelocity?
in
Contributed Library Questions
•
1 year ago
Hi
I was wondering what the difference is between the methods 'addForce' and 'addVelocity' in the VerletParticle class?
Seems to do the same, or?
- import toxi.geom.*;
- import toxi.physics2d.*;
- VerletPhysics2D physics;
- VerletParticle2D pForce, pVelocity;
- void setup(){
- size(600,600);
- noStroke();
- fill(0);
- smooth();
- physics = new VerletPhysics2D();
- physics.setDrag( 0.01f );
- physics.setWorldBounds(new Rect(0,0, width, height));
- pForce = new VerletParticle2D(300,300);
- pVelocity = new VerletParticle2D(300,300);
- pForce.addForce(new Vec2D(1,1));
- pVelocity.addVelocity(new Vec2D(-1,1));
- physics.addParticle(pForce);
- physics.addParticle(pVelocity);
- }
- void draw(){
- background(255);
- physics.update();
- ellipse(pForce.x, pForce.y, 5, 5);
- ellipse(pVelocity.x, pVelocity.y, 5, 5);
- }
1