These latter planets drove the cometary bodies inward towards the sun. Halley's Comet is one of two exceptions to this rule. Pockets of gas form underneath the comet's surface due to solar warming. This was confirmed by the Halley flybys of 1986. In this process, energy of a shorter wavelength, which is invisible to the human eye, is absorbed by the gases of the comet and emitted as longer wavelengths, which can be seen.
Comets generate their own light.
The mechanism which creates one of the two types of tails a comet may possess involves the solar wind and the magnetic field of the sun. The result is a pileup of other solar wind particles in the region. The velocities of the dust particles are modified by the flow of these gases and may even be coupled to the magnetic field sweeping around the comet. Some of this light reaches us to reveal the location of the dust tail. Hyakutake was a dust poor comet.