Hi, I'm not sure if I'm posting this in the correct place so if not I would appreciate being told where I should be posting.

I am making a computer game and I need some help figuring out an equation which the AI can use to help it know which direction to shoot at any given point in time.

The best way I can describe the problem is probably to talk about it in terms of the solar system so here goes....

We are working in 2d and our view is from 'above' the solar system so that if we drew lines following the planets, it would look like the sun was in the middle with concentric circles around it where the planets orbit.

To make the problem simpler, imagine that the orbits of the planets around the sun are perfectly circular (not elliptical), that we can ignore gravitational effects and similar phenomena and that all objects in our model (the planets and rocket) move at a constant speed.

Now, imagine that we want to shoot a rocket from the Earth and hit another planet with it. The target planet may have a smaller orbit than Earth or a larger one (could be closer to the sun or further away). It may also be travelling towards us or away from us. At any point in time, we know the exact location of the target planet (the radius of its orbit around the sun and where it is in that orbit) and the speed it is travelling through space (including whether it is travelling towards us or away from us). Similarly, we know the exact location of Earth and the speed it is travelling through space (although we won't need to use Earths speed in this problem). We also know the exact speed the rocket will be travelling at (remember we are ignoring gravity, etc., the rocket travels at a constant speed from when it is fired to when it impacts the target).

For any point in time, I would like to know how to work out which direction we need to fire the rocket in order to hit the target planet?