Skip to content

Commit

Permalink
Fixed flowfield (CodingTrain#3464)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Shiffman <[email protected]>
  • Loading branch information
DenisovichDev and shiffman authored Jan 5, 2022
1 parent d1fa170 commit b30f2b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ void draw() {
p.follow(flowfield);
p.run();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ public class Particle {
PVector force = flowfield.vectors[index];
applyForce(force);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public class FlowField {
vectors = new PVector[cols * rows];
}
void update() {
float xoff = 0;
float yoff = 0;
for (int y = 0; y < rows; y++) {
float yoff = 0;
float xoff = 0;
for (int x = 0; x < cols; x++) {
float angle = noise(xoff, yoff, zoff) * TWO_PI * 4;
float angle = noise(xoff, yoff, zoff) * TWO_PI;

PVector v = PVector.fromAngle(angle);
v.setMag(1);
Expand Down Expand Up @@ -52,4 +52,4 @@ public class FlowField {
}
}
}
}
}

0 comments on commit b30f2b4

Please sign in to comment.