You'll need to code your own custom method for this, look_at
does what it says on the tin and snaps the obj to the target on the negative z.
Several ways to do this. You could take the target's vector and instead of setting the missile's vector directly as look_at
does you could lerp towards it. Linear interpolation is a bit on the advanced side though if you're a beginner. So I'd recommend just comparing the direction to the target against your heading and rotating the obj accordingly checking each frame how aligned they are.
Getting the unit vector to the target is done with target_vector
minus missile_vector
and then normalising the result (bringing the values between zero and one, so just considering the direction, not the scale). This:
var target_vec = (target_obj.global_transform.origin-missile_obj.global_transform.origin).normalized()
Now you can calculate the dot product of your actual heading against your target heading:
var missile_heading = -missile_obj.global_transform.origin.z.normalized()
var dot_prod = missile_heading.dot(target_vec)
If you don't know, dot product is a calculation where if two unit vectors are aligned then it outputs 1 and if they're at right angles you get zero. Opposite way outputs -1. This way you can make the missile lose track in a realistic way if it's outside a "viewing cone". You'll need to take orthogonal dot products to establish the bearing (the dot product says they're not aligned, it doesn't say which way) and then you can just rotate_object_local
the missile according to these values with a maximum rotation set.
Finally, you just need to set a member variable with your max turn rate and put that in your rotate_object_local
call so that it never turns but more than however many radians you set.
Dot product is about the most useful thing in games so it's well worth looking at a few tutorials.
Hope that helps.