I am trying to fly a spacecraft from a point P orbiting point 3D point X, where the viewer is looking directly at X, to a point Q orbiting another 3D point Y. During the flight I want the view to smoothly follow the path between X and Y so that it appears to the viewer that the spacecraft is simply turning to Y and flying to it.
Whilst that is happening, the spacecraft should move from it's current position (P) at a fixed orbit distance (D1) from X to a new point (Q), a fixed orbit distance (D2) from Y (and those distances will not be the same).
So over time T, I essentially need to compute two 3D coordinates that represent:
- The point in space that the viewer is looking at; and
- The point in space at which the spacecraft has moved to.
For this, we can ignore speed, as the transition is to happen over a fixed amount of time, T.
I've tried to manage this in two stages:
By approximating a point (F1) between P and Q at the initial distance between P and X, and for the first part of the flight, fly to that point whilst focusing on a point between F1 and Y
then once the spacecraft reaches that distance from P, shift the view focus to Y over time whilst continuing to move the spacecraft to Y.
But this does not work well. The view seems to track on X until after passing it (so I get what looks like a neat Jupiter flyby which is not what I want) and then the camera violently flips back towards Y.
I'm thinking that my non-math brain is going at this the wrong way. Here is another figure that shows what I think the path of the viewpoint and the path of the spacecraft need to be.
I'm hoping that someone can help me get this right.
Here is a short clip of what I'm seeing right now.
[Bad Flight Path][3]

