Skip to main content

Simple Particle Simulation (KD-Tree)

I modified the 2.0 example CircleCollision to include some mouse interaction and friction.  The code is up on

Edit: I've now tweaked it to include a KD-Tree data structure, This reduces the number of collision detections per frame down to 1 per particle.  It is computationally cheaper to build the KD-Tree on each iteration than it is to check every particle against every other particle.  The KD-Tree algorithm has been modified from an example by Thomas Diewald.

Edit: I've now tweaked it to include Probabilistic collision detection.

You can interact with this one :)