(NPG) Magnetic objects

Yesterday deep into the night I decided to give another feature I wanted to have in NPG for a long time a try and implemented it. This time it’s magnet objects, which cause magnetic forces applied to all bodies within their range. This makes up for some great stuff, as you can see in the following video (5 MBytes, WMV encoded).

The feature was simple to implement since I already had implemented springs a long time ago, and basically the only difference between a spring between two bodies and the magnetic force between two bodies is the calculation of the resulting force (which is actually very simple for a magnetic object). Right now (due to the fact that it was very late and I just wanted to see how and if it works) most stuff like constants and distance are hard-coded, but will later on be changeable by the user so that every magnetic object can have it’s own magnetic parameters.