# Ball Collision Examples

Hello there :),

Was just looking for examples of collision detection and I came across this post (http://forum.openframeworks.cc/t/circle-to-circle-collisions-and-physics/2004/5) 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.

Cheers!

For the basic basics: You can’t go wrong checking out Processing http://processing.org/learning/topics/bouncybubbles.html

I did some stuff for the new version of a book that I zipped up and posted here for you: http://thefactoryfactory.com/collisionsrc.zip

Also, checking out the ofxBox2d by todd v. https://github.com/vanderlin/ofxBox2d is pretty awesome.

As far as binning, Kyle made a demo that you can find here: http://code.google.com/p/kyle/ uses particles.

octrees might be useful to you too: http://forum.openframeworks.cc/t/ofxoctree/2742/0

the most recent version of the binned particle system lives here right now https://github.com/YCAMInterlab/ProCamToolkit/tree/master/SharedCode/scenes/BinnedParticle

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.

Cheers!