fisica array

edited February 2017 in Kinect

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.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); }`

Sign In or Register to comment.