This was a weekend project where I set up an interactive simulation of a magnetic toy. The real toy has two sets of three magnets mounted on spindles. The spindles are spaced apart just enough to avoid collisions but close enough to allowing magnetic repulsion.
The orange boxes in the video approximate magnets with simple repulsive forces. The white lines that appear from the center of the frame represent a "virtual rubber band" used to pull objects around by clicking and dragging. I used OPAL with ODE to simulate everything here. The resulting dynamics look very similar to the real toy.