// Guide the boid toward the current mouse pointer
//var dx, dy;
// Calculate the offset to move the boid closer
//dx = (b.parent.getMouse('x') - b.x)/20;
//dy = (b.parent.getMouse('y') - b.y)/20;
// Scale this vector by a value determined by the mouse click
// before adding it.
//dx = 1 * dx;
//dy = 1 * dy;
var mouseWeight = b.mouseWeight != null ? b.mouseWeight : influence.mouseWeight;
// Add this velocity
b.velocityX += (b.parent.getMouse('x') - b.x) / mouseWeight;
b.velocityY += (b.parent.getMouse('y') - b.y) / mouseWeight;
velocityLimit) {
b.velocityX = (vx / magV) * velocityLimit;
b.velocityY = (vy / magV) * velocityLimit;
}
]]>
xMax) {
b.velocityX -= boundFactor;
}
// Adjust Y
if (b.y < yMin) {
b.velocityY += boundFactor;
} else if (b.y > yMax) {
b.velocityY -= boundFactor;
}
]]>
var dampening = b.dampening != null ? b.dampening : influence.dampening;
b.velocityX *= dampening;
b.velocityY *= dampening;
i; i++) {
this.influences[i](this, vlist);
}
]]>
this.update();