We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I'm new to Fisica.
I am trying to create a sketch with limited amount of circles inside a container, eventually I will be able to drag them and do some actions on them. At the moment I have two problems, which probably results from one main problem (but I am curious to know the answer to the second question too).
1. Once i've added the circle to the world it continues to generate unlimited amount of circles, and never stops. I've tried to limit it with a for loop but it didn't work. I'm probably missing something really basic here.
2. I have created edges to the world intending to limit the area for the circles. After a lot of circles are being generated they somehow exit the borders and spill outside. I was wondering, why does this happens?
import fisica.*;
FWorld world;
void setup() {
size(400, 400);
Fisica.init(this);
world = new FWorld();
world.setEdges(20,20,300,350,#FFCC00);
}
void draw() {
world.step(1.5);
world.draw();
FCircle myCircle = new FCircle(40);
myCircle.setPosition(width/2, height/2);
// for (int i = 40; i < 80; i = i+1) {
world.add(myCircle);
myCircle.setVelocity(150, 0);
//}
world.setGravity(0, 20);
}
Thanks in advance.
Answers
Dunno that library. But somehow I've come up w/ this: