Permalink
Browse files

Tweak params 1

  • Loading branch information...
1 parent df2baec commit 46be0fcd21d12f80e09376085e8b9efede62fd3e @muraliavarma committed Feb 5, 2013
@@ -95,7 +95,7 @@ class Creature {
fx += weight * (neighbor.posX - posX);
fy += weight * (neighbor.posY - posY);
}
- weightSum *= FLOCKING_CENTERING_WEIGHT;
+ weightSum /= FLOCKING_CENTERING_WEIGHT;
if (weightSum != 0) {
forceX += fx/weightSum;
forceY += fy/weightSum;
@@ -113,7 +113,7 @@ class Creature {
fx += weight * (posX - neighbor.posX);
fy += weight * (posY - neighbor.posY);
}
- weightSum *= COLLISION_AVOIDANCE_WEIGHT;
+ weightSum /= COLLISION_AVOIDANCE_WEIGHT;
if (weightSum != 0) {
forceX += fx/weightSum;
forceY += fy/weightSum;
@@ -131,7 +131,7 @@ class Creature {
fx += weight * (neighbor.velX - velX);
fy += weight * (neighbor.velY - velY);
}
- weightSum *= VELOCITY_MATCHING_WEIGHT;
+ weightSum /= VELOCITY_MATCHING_WEIGHT;
if (weightSum != 0) {
forceX += fx/weightSum;
forceY += fy/weightSum;
Binary file not shown.
Binary file not shown.
@@ -29,9 +29,9 @@
final float COLLISION_AVOIDANCE_RADIUS = 0.1f;
final float VELOCITY_MATCHING_RADIUS = 0.1f;
-final float FLOCKING_CENTERING_WEIGHT = 100;
-final float COLLISION_AVOIDANCE_WEIGHT = 100;
-final float VELOCITY_MATCHING_WEIGHT = 100;
+final float FLOCKING_CENTERING_WEIGHT = 0.01f;
+final float COLLISION_AVOIDANCE_WEIGHT = 0.02f;
+final float VELOCITY_MATCHING_WEIGHT = 0.02f;
final float WANDERING_WEIGHT = 0.0002f;
int edgeBehavior = REFLECT_MODE;
@@ -210,7 +210,7 @@ public void applyForces() {
fx += weight * (neighbor.posX - posX);
fy += weight * (neighbor.posY - posY);
}
- weightSum *= FLOCKING_CENTERING_WEIGHT;
+ weightSum /= FLOCKING_CENTERING_WEIGHT;
if (weightSum != 0) {
forceX += fx/weightSum;
forceY += fy/weightSum;
@@ -228,7 +228,7 @@ public void applyForces() {
fx += weight * (posX - neighbor.posX);
fy += weight * (posY - neighbor.posY);
}
- weightSum *= COLLISION_AVOIDANCE_WEIGHT;
+ weightSum /= COLLISION_AVOIDANCE_WEIGHT;
if (weightSum != 0) {
forceX += fx/weightSum;
forceY += fy/weightSum;
@@ -246,7 +246,7 @@ public void applyForces() {
fx += weight * (neighbor.velX - velX);
fy += weight * (neighbor.velY - velY);
}
- weightSum *= VELOCITY_MATCHING_WEIGHT;
+ weightSum /= VELOCITY_MATCHING_WEIGHT;
if (weightSum != 0) {
forceX += fx/weightSum;
forceY += fy/weightSum;
@@ -14,18 +14,18 @@ final float FLOCK_CENTERING_RADIUS = 0.2;
final float COLLISION_AVOIDANCE_RADIUS = 0.1;
final float VELOCITY_MATCHING_RADIUS = 0.1;
-final float FLOCKING_CENTERING_WEIGHT = 100;
-final float COLLISION_AVOIDANCE_WEIGHT = 100;
-final float VELOCITY_MATCHING_WEIGHT = 100;
+final float FLOCKING_CENTERING_WEIGHT = 0.01;
+final float COLLISION_AVOIDANCE_WEIGHT = 0.02;
+final float VELOCITY_MATCHING_WEIGHT = 0.02;
final float WANDERING_WEIGHT = 0.0002;
int edgeBehavior = REFLECT_MODE;
int backgroundAlpha = 100; //0 for full trail, 255 for no trail
//flock centering, velocity matching, collision avoidance, wandering force
boolean flockCenteringForce = false;
-boolean velocityMatchingForce = false;
boolean collisionAvoidanceForce = true;
+boolean velocityMatchingForce = false;
boolean wanderingForce = false;
void setup() {

0 comments on commit 46be0fc

Please sign in to comment.