# What parameters determine the acceleration a spacecraft can acquire using the gravity of a celestial body?

Contemporary spacecraft frequently rely upon gravity to accelerate/decelerate. Given a spacecraft already in space - What factors determine the acceleration it can acquire from the gravity of another body? Is there an upper limit to such gravitational acceleration?

-

You can get an idea of the maximum acceleration possible by working in your rest frame i.e. the frame in which you're stationary and the planet is approaching you at a speed $v$. If you can arrange to do a half loop round the planet and exit in the opposite direction then you'd leave the planet at a speed relative to the planet of $v$, and because in our frame the planet is moving at a speed $v$ you'd end up travelling at a speed of $2v$.