I want to create a simple 2d Gravity simulator where I have a large body i.e. A circle which could be a planet or the sun. I then want to simulate small comets or asteroids travelling past it, crashing into or being pulled into orbit. I know the gravitational force formula but that seems the simple part. What I want to know is how to calculate the trajectories for objects flying past. I guess speed and angle of approach determine whether a smaller object will crash, go past or go into orbit around the larger body. Any explanations or sources would be appreciated.