Planetary Gravity Physics

BlitzMax Forums/BlitzMax Programming/Planetary Gravity Physics

Gravitational constant G = 6.67E-11 N m^2 kg^-2 (i.e. if your forces are measured in Newtons, mass in kilogrammes and distance in metres). Essentially it's a fiddle factor though - Start at G=1.0 and change it until it feels right, reducing it if the force is too strong and increasing it if it's too weak.

You'll probably want to use a = F/m to find the acceleration of each body. That is, a1=G*m2/(r*r) and a2=G*m1/(r*r).

And in 2D vector form,
r = Sqr(r_x*r_x + r_y*r_y)
a1_x = G*m2*r_x/(r*r*r)
a1_y = G*m2*r_y/(r*r*r)

(I think :) ) Where <r_x, r_y> is the distance between objects in x and y directions, m2 is the mass that's attracting your object, <a1_x,a1_y> is the acceleration at that moment in time at that point in space.

A good resource that I use: http://scienceworld.wolfram.com/physics/Gravity.html