I took this code from the last part of my weapon targeting system(from my kart game) and commented it. It works for the most part, rather simple though. You've gotta find and perfect the offset by trail and error. I used it for my projectile shooting turrets. It sits after a wad of code detecting lock-on angles, hence the additional offset determined by that "temp2 += target_front;". You prolly won't need any additional offset though. But you can use this for dumb A.I, throws the aim off...
Code:
//Find x offset between target and future position
dist = vec_dist(you.x,my.x); dist = vec_length(dist); dist += you.fspeed*2;//speed of targetx2, change if needed, this adds to offset
temp2 += target_front;//additional offeset(if needed, otherwise "1")
dist /= temp2; //final offset
//Set and rotate offset by target
temp.x = dist; //front-back offset
temp.y = you.kslide_speed*3; //set for targets strafe speed
temp.z = -15; //height offset
if(you.z > vvec){temp.z *= 0.8;}else{temp.z *= 1.2;} vvec = you.z; //If target moves up or down, reflect this in offset
vec_rotate(temp.x, you.pan); //find angle to aim the turret at
vec_add(temp,you.x); vec_diff(temp,temp,my.x); vec_to_angle(app.pan,temp);
//rotate turrent joint to target, inverse may not be needed with your game
app.roll = 0; vec_inverse(app.tilt); vec_sub(app.pan, my.pan); app.pan += 180;
ent_bonereset(my,"bone"); ent_bonerotate(my,"bone",app.pan);