I've been developing a planetary simulator in Unity 3D (C#) and I need some help, however I feel this would be a better place for it. I'm starting my planet from a position vector. On initialisation I apply a direction vector, which puts it into orbit around a larger star. The orbits aren't circular, and I'd like for them to be elliptical.
I've read up on foci, the semi-major axis and semi-minor axis, on several laws by Newton and Kepler, I understand the apoapsis and periapsis, and yet I just can't figure out what I need to do. What I've done is leave a trail from the planets, and the orbits can be seen. (note: I know the layout of planets aren't correct!)
It looks nice, but it's not what I wanted. I'd like to be able to predict the orbit. I've found equations so I can calculate the sphere of influence, which require the semi-major axis. I could calculate the semi-major axis if I had the orbital time, and I could calculate the orbital time if I had the semi-major axis. However I only have an initial position, a vector force I apply to it, the distance between the planets, and also the masses of each. I'm at a dead end here, I'm not sure what I'm looking for. Could anybody please give me some pointers (or formulae) in order to do what I'd like to do.
I'd really appreciate any help, thanks in advance!