Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PVector [] asts = new PVector [astN];
- for (int i = 1; i < astN; i++) {
- asts[i] = new PVector(random(0, width), random(0, height));
- }
- pushMatrix();
- scale(astSiz);
- translate(asts[i].x, asts[i].y);
- shape(model);
- popMatrix();
- //PVector [] accs = new PVector [astN];
- //PVector [] vels = new PVector [astN];
- for (int i = 1; i < astN; i++) {
- PVector [] tempAccs = new PVector [astN];
- float [] tempforces = new float [astN];
- tempAccs[i] = PVector.sub(pos2, asts.get(i));
- tempAccs[i].normalize();
- tempforces[i] = grav*mass/pow(PVector.dist(asts.get(i), pos2), 2);
- tempAccs[i].mult(tempforces[i]);
- accs[i].add(tempAccs[i]);
- }
- for (int i = 1; i < astN; i++) {
- vels[i].add(accs[i]);
- vels[i].mult(0.5);
- asts.get(i).add(vels[i]);
- accs[i] = new PVector();
- accs[i].set(0,0);
- }
Add Comment
Please, Sign In to add comment