The most obvious solution is "turn towards the target and then fly towards it. Then stop and turn to the orientation you want to be at." But I'm having trouble with even doing this (for instance, how do you turn "towards" something in 3D space?
)
I wrote a flight simulator with a simple dogfighting and navigation AI. The navigation AI is unsatisfactory in certain ways so I'll describe the dogfighting one, and maybe it will give you some ideas.
I didn't want to have to learn the maths of quaternions or anything like that, so I decided to use an existing physics library (ODE), originally just to have something to take care of rotations for me, although I ended up using it for much more. Also, I had a working flight model, so rather than having the AI set its own rotation or thrust in a brute-force way, I was able to let it control the engine and the flight surfaces. This had the effect of making the movement more natural, and it was also much simpler conceptually to think of what the AI should do in a given situation.
Say you are aircraft A and you want to fly at aircraft B. There are basically three cases:
1 - B is directly in front of you. Then do fine tuning stuff to keep him in front of you, rotate to stay aligned with him, and if things are just right, fire.
2 - B is above your nose. Then pull back on the stick, so you pitch up to bring him in front of you.
3 - B isn't directly in front of you or above your nose. Then roll towards him until he is above your nose.
The main trick, and the thing which tells you which case you are in, is to get the unit vector from yourself to B *in your local coordinates*. This means that you let f be a unit vector in the direction of your nose, u be a unit vector pointing up out of the top of your head, and l be a unit vector in the direction of the left wing (or possibly right wing, depending on how things are set up). You want to express a unit vector from A to B as a combination of these. You can do this by dot products, or maybe the physics library will have utility functions to convert from global vectors to ones in a body's own local coordinate system.
Once you have these, if the f component is large, B is in front of you, and you are in case 1 (where to rotate to the same plane as him, you take his up vector and look at it in your local coordinates, to decide which way to roll).
If the u component is positive and the l component has small absolute size, then he is above you and you are in case 2. You should pull back on the stick, and you can even (as a sensible first thing to try), make the amount you pull back proportional to the u component (so long as B isn't actually behind you).
Otherwise you are case 3, and B is to one side (or below you, but let's ignore that). Then if the l component is positive he is to the left and you should roll that way, and if it is negative you should roll the other way. So you just (as a first try) set the displacement of the ailerons proportionally with the l component.
The main problems with using this AI for something other than mindless dogfighting is that it knows nothing about sensible level flight, or even which way is up.