# Calculating theta/anomaly for a hyperbolic orbit based on time step

I'm soing some kepler based orbital mechanics for a game prototype I'm working on, am a bit of a newbie to both orbital mechanics and a little challenged at reading the algebra equations that are mostly used around these parts so please forgive me that.

I have elliptical orbits working perfectly, where I can specify a time parameter and calculate the mean anomoly to pass into the kepler equation, to obtain the correct position along the orbit a ship will have travelled in the passed time.

anomalyIncrease = 2PI * timeSinceLastTick / period;

I've now got hyperbolic trajectories working, where I can apply acceleration to an elliptical kepler orbit, and transform it into a correct hyperbolic orbit if its eccentricity goes over 1. However, since I have no 'period' since it's no longer an orbit, I'm not finding any easy to digest information on how to obtain an amount to increase theta per timeSinceLastTick to step the correct distance along the trajectory to keep the ship's relative speed consistent between elliptical and hyperbolic.

Calculating true anomaly of a hyperbolic trajectory from time

which seems to be what I'm after, however I'm finding it really hard to reverse the attached equations which seem to obtain time and velocity from a known theta, and would be massively appreciative if someone could reorganise the formula and explain so that theta = XXXX instead of time = XXXX.

Apologies again for being so green, I'm picking it all up but still struggle when presented with scary formulas. Wish I listened more in algebra :)

That equation cannot be solved exactly for $\theta$ because it is transcendental. However, it looks like Newton's method can easily be used because the derivative is simple. Rearrange to
$$f(\theta) = e\sinh\theta - \theta - \sqrt{\frac{GM}{a^3}}t = 0$$
$$f' = e\cosh\theta - 1$$
So every time step, you will pass $t$ into $f(\theta)$ as a parameter and then use Newton's method to solve for $\theta$ as accurately as you can.