  Giant molecular clouds (GMCs) are believed to affect the biospheres of
planets as their host star passes through them. We simulate the trajectories of
stars and GMCs in the Galaxy and determine how often stars pass through GMCs.
We find a strong decreasing dependence with Galactocentric radius, and with the
velocity perpendicular to the Galactic plane, $V_z$. The \textit{XY}-component
of the kinematic heating of stars was shown to not affect the GMC hit rate,
unlike the \textit{Z}-dependence ($V_z$) implies that stars hit fewer GMCs as
they age. GMCs are locations of star formation, therefore we also determine how
often stars pass near supernovae. For the supernovae the decrease with $V_z$ is
steeper as how fast the star passes through the GMC determines the probability
of a supernova encounter. We then integrate a set of Sun-like trajectories to
see the implications for the Sun. We find that the Sun hits $1.6\pm1.3$ GMCs
per Gyr which results in $1.5\pm1.1$ or (with correction for clustering)
$0.8\pm 0.6$ supernova closer than 10 pc per Gyr. The different supernova
frequencies are from whether one considers multiple supernova per GMC crossing
(few Myr) as separate events. We then discuss the effect of the GMC hits on the
Oort cloud, and the Earth's climate due to accretion, we also discuss the
records of distant supernova. Finally, we determine Galactic Habitable Zone
using our model. For the thin disk we find it to lie between 5.8-8.7 kpc and
for the thick disk to lie between 4.5-7.7 kpc.
