We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Why a poly object to create in the void setup(), or repeated drawing;I want to join an activity poly object.
`import fisica.*;
FWorld world; FPoly poly;
PVector[] xy = new PVector[5];
void setup() { size(640, 480);
Fisica.init(this); world = new FWorld(); world.setGravity(0, 800); world.setEdges(); world.remove(world.left); world.remove(world.right); world.remove(world.top); world.setEdgesRestitution(0.5);
world.add(poly);//// newBody();//// poly.removeFromWorld();////
for (int i = 0; i<xy.length; i++) { xy[i] = new PVector(random(100,width-100), random(100,height-100)); } }
void draw() { background(255); world.step(); world.draw(this); drawb(); poly.draw(this); }
void drawb() { for (int i = 0; i< xy.length; i++) { poly.vertex(xy[i].x+random(25), xy[i].y+random(25)); } }
void newBody() { poly = new FPoly(); poly.setPosition(width/8, height/8); poly.setStrokeWeight(1); poly.setStroke(0, 100); poly.setNoFill(); poly.setDensity(10); poly.setRestitution(0); }`