Re: orbits...
- Posted by DHarte at AOL.COM Sep 25, 1998
- 580 views
I assume that you want to know how to simulate an orbit using real physics. To get one body to orbit another, you must give it an initial velocity. If you want to make it move in a circle, give it initial velocity, v0=sqrt(GM/r), where M is the mass of the planet, r is the radial distance (between the centers of mass), and G is the gravitational constant. This velocity must be tangent to the circle that you want the object to orbit at. To get the rest of the simulation, you use Fn=GMm/r^2, an=Fn/m, vn=v(n-1)+an dt, xn=x(n-1)+vn dt (the n's and (n-1)'s are supposed to be subscripts). These are vector equations. You will probably have to parametrize the variables (or use sequences for vectors) to get it to work. Abraham Harte