Hi I’m new to Processing and I’m dabbling with the example: Circle Collision with Swapping Velocities by Ira Greenberg : Circle Collision with Swapping Velocities / Examples / Processing.org
I can post the code if you like but this is a general question about Processing performance slowing down.
That example has just 2 balls moving around the screen and bouncing off each other as well as off the edges of the canvas. Each ball is an instance of new Ball(x, y, r_(radius)) and draws an ellipse:
void display() {
noStroke();
fill(r,g,b);
ellipse(position.x, position.y, radius*2, radius*2);
}
I changed my version by using a for loop to add lots of instances of new Ball() and it works well. I can have hundreds of balls (or in my case particles) bouncing off each other. The problem comes when I start adding thousands. When the balls start moving everything slows down.
Is this just stretching the boundaries of my processor or is there a better way to draw the ellipses so that I can have thousands moving around the screen? Should I try to create some kind of reusable symbol or something? I have tried increasing the available memory in preferences but nothing changes.
Thanks.