Commit 23c4174d authored by Jens-Christian Fischer's avatar Jens-Christian Fischer
Browse files

Tweak flocking

parent f7247b57
......@@ -3,7 +3,7 @@ defmodule Grains.Mixfile do
def project do
[app: :grains,
version: "0.0.67",
version: "0.0.68",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
......
......@@ -68,7 +68,7 @@ Boid.prototype.flock = function(boids) {
coh.mult(this.cohesion_f);
// Add the force vectors to acceleration
this.applyForce(sep);
this.applyForce(ali);
// this.applyForce(ali);
this.applyForce(coh);
};
......@@ -122,7 +122,7 @@ Boid.prototype.borders = function() {
// Method checks for nearby boids and steers away
Boid.prototype.separate = function(boids) {
let that = this;
var desiredseparation = 25.0;
var desiredseparation = 50.0;
var steer = this.p.createVector(0, 0);
var count = 0;
// For every boid in the system, check if it's too close
......@@ -188,7 +188,7 @@ Boid.prototype.align = function(boids) {
// For the average location (i.e. center) of all nearby boids, calculate steering vector towards that location
Boid.prototype.cohesion = function(boids) {
let that = this;
var neighbordist = 50;
var neighbordist = 150;
var sum = this.p.createVector(0, 0); // Start with empty vector to accumulate all locations
var count = 0;
_.each(boids, function(boid) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment