Electro Magnetism

Electro magnetic force is generated by the electric charge of an object. Unlike gravity, electromagnetic force can be both attractive and repulsive.

A compass is a good example of this force type. The needle points to the North Pole, because the sign of the force field at the North Pole is opposite to the sign of the needle of the compass.

A compass

1. Create two small analytic spheres representing the north and the south poles.

2. Select the north pole sphere and go to the Phys tab in the property window. Set Electric Charge to 10. Then set the electric charge of the south pole to -10.

3. Create a level object consisting of two sub objects representing the two ends of the compass needle. Set electric charge of the 'north' end sub object to -1 and electric charge of the south end to 1.

4. Select the 'pole' spheres. In the Sim tab, set Magnetism to Cause.

5. Select the needle level object. In the Sim tab, set Magnetism to Affected. In other words, the needle does not generate a magnetic field, it is just sensitive to the field generated by the north and south poles.

6. Remember to turn on Simulation of the parent level of the compass needle.

In the real world, even tiny compass needles generate a magnetic field. The field is just so weak that most magnetic objects near the compass do not notice it. If you want the needle to generate an electro magnetic field, select Magnetism = Both option. If you have lots of compasses and the field generated by the needle is irrelevant, you might want to switch it off - this simplifies the simulation and increases animation playback speed.

The sample project 'tutorprojects/simulation/compass' includes a slightly more interesting setup: the needle contains two connecting rods and a cylindrical ring in the middle. A 'heavy' pole goes through the ring, anchoring the needle using collision detection. The ring and pole have some friction and their rebound energy is less than 1. This stabilizes oscillations of the needle when it orientates to the magnetic field.

A compass simulation