Original Post
Given the motion equation (d = v*t + 0.5*a*t2), I can find a vehicle's position after a given passage of time with a given starting velocity and constant acceleration. Solving this equation for two dimension allows me to calculate spaceship movement in a Gravity Wars-style game. That same formula can also be used by missiles that the ships will shoot at each other. Now I want to throw in some gravity wells (planets, black holes, etc.). How can I calculate the final position of a missile or ship at a given time, with an initial velocity, acceleration, and one or more sources of gravity? Is there a formula for calculating the trajectory of a vehicle with those parameters? I know I could simply apply gravity to the ship's position each game tick, but that would yield different results depending on the length of each tick. I would really like a solution that yields identical results regardless of the change in time. Any thoughts? - Mike