Hello !

First let the constant velocity of your planets be expressed in metres per second. Let the velocity of the rocket be expressed in metres per second.

Now let us consider only the target planet, the earth and the rocket. The rocket is fired from the earth and keeps a constant velocity throughout the journey until it eventually hits the target planet. For simplicity we will consider the target planet as being a point in space, and the rocket will hit this exact point (so no need for radius considerations).

So if you represent this as a diagram, you will get the earth moving in a concentric circle, and the target planet moving in a "curved parallel" fashion. Now here is the problem : the two planets move at the same time, but they don't keep a relative position to each other. We'd better consider that the Earth is located at the origin, because then the target planet is essentially rotating around the Earth at a constant velocity (since we have perfectly concentric circles).

First step is to find the constant velocity of the target planet relative to the Earth. This is quite easy, if we assume the Earth has radius in metres, and assume the rocket is aiming for the center of the target planet, then we know when the Earth has completed a half-rotation, the target planet will also have completed a half-rotation. Since the Earth has velocity , and travelled exactly metres during this half-rotation, then we have seconds. Now that is also the time taken for the target planet to rotate, and since its distance to the Earth is also known and denoted by , we have

So now we know the relative velocity of the target planet. We also know its position relative to the Earth (which is achieved by a trivial origin translation). The next step is to find the distance the rocket has to travel. This is really easy, by using the distance formula. Assuming the target planet center has relative coordinates , then its relative distance to the Earth is . And since the target planet rotates around the Earth in a perfect circle, this distance is constant.

Another thing, we know the rocket travels at a velocity of , so the time taken for the rocket to reach the target will be . Since the velocity and the distance is constant, the time will be constant too.

Now this is really easier, as we know the velocity of the target planet relative to the Earth, the time that it will take for the rocket to reach it and its distance relative to the Earth. The last thing we need to know is how much distance the target planet travels relative to the Earth during the time the rocket travels, which can be expressed in terms of curved displacement. Since the circumference of its orbit is , and it takes exactly seconds to travel a half-rotation, it must travel exactly metres per second. Thus its displacement during the time the rocket is reaching its target will be :

Now what is left to do is calculate the angle of the target planet when the rocket is about to be fired, calculate the angle of the target planet when it has displaced during the time the rocket fired, and that will be the shooting angle for the rocket.

If the target planet has coordinates , then it has a relative angle to the Earth of .

Now, if the target planet has a displacement , a radius , and an original angle , then the new angle (after displacement) will be equal to .

Conclusion

It turns out most of this stuff cancels out when putting it all together, so we really find ourselves with a simple formula at the end of the day :

- is the constant velocity of the Earth

- is the constant velocity of the rocket

- is the radius of the Earth

- are the coordinates of the target planet relative to the Earth

The rocket will hit the center of the target planet,spot on, if and only if the rocket is fired at an angle of :

All of this in radians, of course !

Note that this formula, if it turns out to be correct (which I hope it will be !), and if applied properly, will effectively make the rocket do a bull's eye on the target planet, it cannot possibly handle other planets getting into the way of the rocket ! If you need to handle that too, I'm afraid it is going to be quite complicated, especially if the target planet is far away. Well not that complicated actually, if you follow my reasoning you would naturally be computing the displacement of the other planets susceptible of blocking the rocket, and checking whether they can potentially get into the way of the rocket, and if yes, then delay the shot for a bit, then recheck (you can't just shoot elsewhere, you probably won't even hit the target planet)

Also note that it would be foolish to stupidly attempt to implement this formula in your computer game, as it will probably have to do a couple of precomputations, such as translating the global coordinate system so that the Earth is the origin, and putting everything in radians ... well anyway, I suggest you really try to understand how it works. There's a lot of steps but once you get the idea it's really simple, the hardest part being to manipulate it all at once