I'm making a space exploration game. It will all take place within a single 2D plane (no inclination) and use patched-conics approximation so that a spacecraft is only gravitationally affected by one celestial body at a time. I have orbit simulations working perfectly given a set of parameters. These are the variables that orbits have in the program:

  • semi-major axis (meters)
  • eccentricity
  • argument of periapsis (radians)
  • whether the orbit is prograde or retrograde
  • standard gravitational parameter of the celestial body being orbited (m^3 s^-2)
  • the eccentric anomaly at t = 0 (radians)

And an object's current position is stored as its current eccentric anomaly in radians. Using these six parameters, I can define any elliptical orbit in the plane, and get the position and velocity of the object for any given time or eccentric anomaly.

What I can't do yet is make the orbit change based on the spacecraft's acceleration. Given a current eccentric anomaly, all six orbital parameters for an object, and a 2D vector for change in velocity, how can I compute the new orbital parameters?


2 Answers 2


So you know $\mu$ r and v, right? And you want to find a and e?

The Vis Viva equation tells us:
There's your expression for a.

I make mistakes so it's a good idea to check my algebra.

Now to find e. Denote specific angular momentum as h.
Now $h=|\vec{h}|=|\vec{r}\times\vec{v}|$. Substitute this value into the above and you get e.

Again, it's a good idea to check my algebra.

  • $\begingroup$ Thank you, I did not know those equations existed. I'm learning a lot making this game :) However, a and e alone are not enough to define the orbit. I also need an argument of periapsis to define the 2D rotation of the orbit. $\endgroup$
    – Jimmy
    Commented Aug 17, 2017 at 19:56

If you already have your zenith angle $\gamma$, between velocity v and radius r, then

$$e^2 = 1-\frac{v^2r}{\mu} \ (2 - \frac{v^2r}{\mu}) \ sin^2(\gamma)$$

Derive this by substituting $|\mathbf{h}| = |\mathbf{r}||\mathbf{v}|sin(\gamma)$ and vis viva for $1/a$ into HopDavid's equation.

  • $\begingroup$ I've edited your answer and inserted the standard MathJax that is used in Stackexchange for equations etc. Take a look to make sure it still says the same thing, but I think it's unchanged. You can take a look here for a tutorial (which usually comes up if you search for "mathjax stackexchange") or read about MathJax elsewhere. $\endgroup$
    – uhoh
    Commented Aug 18, 2017 at 3:48
  • 1
    $\begingroup$ UhOh, thank you for the edit and reference. I missed the requirement for leading and trailing $ signs in MathJax. - MBM $\endgroup$
    – MBM
    Commented Aug 18, 2017 at 17:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.