Gravity Simulator 2D: Calculating Trajectories

Click For Summary
SUMMARY

The discussion focuses on creating a 2D gravity simulator that models the trajectories of small celestial bodies, such as comets and asteroids, in relation to a larger body, like a planet or sun. The gravitational force formula used is ##\vec F = - {GMm\over |\vec r|^2} \, \hat r##, and the equation of motion is defined as ##\vec F = m\vec a##, with acceleration expressed as ##\vec a = {d\vec v \over dt}##. The conversation emphasizes the importance of speed and angle of approach in determining the trajectory outcomes—whether an object will crash, pass by, or enter orbit. Additionally, it notes the complexity introduced when considering the gravitational influence of the smaller body on the larger one.

PREREQUISITES
  • Understanding of gravitational force calculations
  • Familiarity with Newton's laws of motion
  • Basic knowledge of coordinate transformations
  • Proficiency in 2D physics simulations
NEXT STEPS
  • Research the implementation of gravitational force calculations in 2D simulations
  • Learn about trajectory calculations using initial speed and angle of approach
  • Explore coordinate transformations for motion equations in 2D
  • Investigate the effects of mutual gravitational influence in multi-body simulations
USEFUL FOR

Game developers, physics enthusiasts, and educators interested in simulating celestial mechanics and gravitational interactions in a 2D environment.

Pink panther
Messages
1
Reaction score
0
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 traveling 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.
 
Physics news on Phys.org
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.​
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K