I'm working with a group of architecture students, who are very new to programming (starting 1 day ago), and we've been tasked with developing a collision program to test crowd dynamics around small obstacles.
We've been lucky enough to find a sketch by Sabin Serban (whose sketch can be found here)
http://www.openprocessing.org/sketch/82295), that can do most of what we would like to be able to do.
However, we're having problems with adding permanent geometry (to represent walls) that the balls can collide with - so that the velocity reverses and the ball bounces off of the rectangle/wall.
Here is the code we have so far. I'd appreciate some assistance in developing this.
Many thanks,
Alistair
Agent[] aArray;
PVector[] oArray;
float speedLimit = 1;
float perceptionDistance = 100;
float normalDistance = 10;
float privacyDistance = 10;
boolean pause;
PImage img;
void setup() {
img = loadImage("PICCADILLY GARDENS MAP.jpg");
size(750,532);
background(img);
aArray = new Agent[300];
oArray = new PVector[0];
for (int i=0; i<aArray.length; i++) {
aArray[i] = new Agent(round(random(width)), round(random(height)), i);