Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gravity simulator 2d

  1. Dec 28, 2015 #1
    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.
  2. jcsd
  3. Dec 28, 2015 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Hello Pinky, :welcome:

    Your gravitational force formula is most likely something like ##\vec F = - {GMm\over |\vec r|^2} \, \hat r##. The equation of motion is ##\vec F = m\vec a## where ##\vec a = {d\vec v \over dt}## and ##\vec v = {d\vec r \over dt}##.
    If you want it in x, y coordinates you will need a coordinate transformation at some suitable moment.
    That's really all there's to it !

    Things become more complicated if you want to can no longer ignore the influence of the smaller m on the big M. Maybe that comes later; for now I interpret your large/small as a permit to ignore the motion of the large body.​
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Gravity simulator 2d
  1. Simulated gravity (Replies: 4)

  2. Gravity in 2D (Replies: 43)

  3. Gravity in 2D universe (Replies: 21)

  4. Gravity Simulator (Replies: 1)