Obviously that question doesn't have a lot of jargon having to do with math and physics. I am not a physicist, I'm not a mathematician, I'm trying to make a game and simulate some physics found in space so if this isn't quite verbose enough I apologize. But as I said, I need a way to calculate the velocity of the object after it leaves the planets/celestial bodies gravitational pull. The values I would need and please don't leave me with an equation that is seemingly complicated to the average person. Please explain what the value of each variable would be and so forth.


2 Answers 2


It is not clear at which level you want to simulate this.

Fine grained

If you want to do this on a very fine grained level, you just need so simulate Newtonian mechanics and gravity and it should emerge from itself when you have a trajectory set up.

This means that you compute the gravitational force to be $$ \vec F = - G \frac{Mm}{r^3} \, \vec r \,, $$ where $\vec F$ is the force vector, $G$ is the gravitational constant, $M$ is the mass of one object (say the planet) and $m$ is the mass of the satellite or space ship. $r$ is the distance between the two objects and $\vec r$ is the same just as a vector. With my sign convention the vector $\vec r$ will be opposite in direction than the force $\vec F$. This means that you have to choose $\vec r = \vec x_1 - \vec x_2$ such that the force is attractive.

Then you use Newtonian mechanics which in your case here reduce to simple $\vec F = m \vec a$. Here $\vec a$ is the acceleration vector. Acceleration is the change of velocity over time. One can write $\vec a = \mathrm d \vec v / \mathrm d t$ where $\vec v$ is the velocity and $t$ the time. Without the derivative, one could write it as $\vec a = \Delta \vec v / \Delta t$.

From there, you set some initial conditions (position, velocity) for your planet and satellite. You can use a fancy ODE solver like Runge-Kutta. For a start the simple Euler method will be enough. There you use $\Delta \vec x = \vec v \cdot \Delta t$ and $\Delta \vec v = \vec a \cdot \Delta t$. Using the force, you will have $$\Delta \vec x = \vec v \cdot \Delta t \qquad\text{and}\qquad \Delta \vec v = \frac{\vec F}{m} \cdot \Delta t$$ to get from one time step to the next one. So at each step you have a position $\vec x$ and a velocity $\vec v$. You compute the force $\vec F$ and can evolve you system by one time step $\Delta t$.

Coarse grained

One can also look at the slingshot maneuver as an elastic collision. Before and after the collision the total momentum and the total kinetic energy must be conserved. Using that you can use compute the new velocities after the collision. The one of the planet will likely not change at all if it is way heavier than the satellite. Doing that in one dimension is possible using one of the simpler equations on the Wikipedia page.

Doing it in two dimensions needs a bit more work as you will have a collision angle. The case in three dimensions can be reduced to happen within a two dimensional plane. One has to figure out where that lies.

I hope this helps you a little bit to get started or to refine or question.


Well, the "object" has two kinds of energy at all times: kinetic (movement), and gravitational potential. This calculation you want to do is easiest if there is only one significant body, like the sun. In this case, at the beginning your KE (kinetic energy) is 0.5mv2, and your gravitational energy is Ug = -Gm1m2/r.

Now, an object can never completely leave the gravitational pull of another object. but it becomes negligible eventually. At this point, the gravitational potential formula returns zero. Potential energy is relative, which means what the formula gives isn't what matters, it's the difference between the PE of two points. (I really hope I'm wording this well enough) So, the difference between the PE of a certain point and... infinity, where gravity is zero, (or just far enough away that it's negligible), is equal to the value returned by the formula. So plug your two masses and the starting distance, and obtain how much kinetic energy will be converted to potential. Now calculate the starting kinetic energy (0.5mv2) and subtract the potential from it.

So, We're on the home stretch. Just math from here. Kf = Ki-Ugi

where Kf is final kinetic energy, Ki is initial kinetic, and Ugi is initial potential.

So, 0.5m2vf2 = 0.5m2vi2 - Gm1m2/r

0.5m2vf2 = 0.5m2vi2 - Gm1m2/r

0.5vf2 = 0.5vi2 - Gm1/r

vf2 = vi2 - 2Gm1/r

vf = √vi2 - 2Gm1/r

There it is. Final velocity equals the square root of initial velocity squared minus 2Gm/r, m being the mass of the planet or sun we are escaping, r being the the distance from it that we started out at, and G, of course, being the gravitational constant.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.