A rail gun consists of two parallel conducting rails with a conducting projectile in between and in contact with both. A magnetic field is generated when an electric current passes through a wire, thus inducing a force which causes an object to accelerate.