Guided Missle Lock

I'm adding guided missles to my game and would like them to lock onto a particular entity in my world. Parsing through the list of entities is not a problem. Rather, I'd like some feedback, thoughts or ideas for algorithms to acquire the lock. Thanks.[/align]

Factoring in range to target might be a good idea. I'm not a guided munitions expert or anything, but I was under the impression that radar lock had a range beyond which is wasn't able to achieve good tone.

Unless you're planning on having shedloads (read: 1,000+) lockable entities in you entire game world, worrying too much about this algorithm is just premature optimization. I find that's it's a lot easier to optimize when you have something that's running slow, instead of optimizing before it's going slow.

Subtract the position of the target from the position of the missile and normalize it.

Take the cross product and dot product between the missile's current direction and that vector to get axis and angle.

Clamp the angle to some arbitrary maximum (or minimum if negative) so that the missile doesn't instantly reorient directly toward the target.

Rotate the missile along the computed axis/angle.

Based on earlier discussion in this thread, it sounds like determining which target to choose may be an issue. To get the closest object in front of you, I'd just loop through all of your objects, subtract their positions from your missile's position, check if dot product is positive, and if so, pick the one with the lowest squared distance from the missile.