Ball Collision Examples

Hello there :),

Was just looking for examples of collision detection and I came across this post ( on ball collisions using binning, would love to have a go at something similar but it seems the links no longer work.

Are the tutorials still about or are there any other resources that go over similar techniques that anybody knows of?

Any help would be greatly appreciated.


For the basic basics: You can’t go wrong checking out Processing

I did some stuff for the new version of a book that I zipped up and posted here for you:

More advanced:

Also, checking out the ofxBox2d by todd v. is pretty awesome.

As far as binning, Kyle made a demo that you can find here: uses particles.

octrees might be useful to you too:

the most recent version of the binned particle system lives here right now

but i’m working on making a single “OF demos” repository that has all this stuff (especially stuff i’ve previously hosted on google code).

i would also add: there is a big difference between proper “hard” collisions and “soft” collisions. “hard” means you test for collision, and then compute the resulting velocities of the masses involved in the collision. three balls colliding is different than two, etc. things can accidentally pass through each other. but with “soft” collisions, you just have an opposing force that goes from 0 to “very strong” as the balls get really close. this is easier to code, and more stable, but looks different.

You have both been a great help, thanks so much! I will give it all a go.