Helicopter Game: Missile locking

This may seem like a simple thing to anyone who uses unity, But this was one of the more challenging things to make and look realistic so they turn at a realistic pace and have a chance to miss.


First you many would say use the built in “transform.lookAt()” function but this meant the missile turned instantly and exploded as it collided with the helicopter, So i added a simple 0.5s gap between firing and turning, For those who don’t know a simple time gap is done like so:

But this still lead to a very unrealistic turning after the time gap. While looking for examples of other ways people where talking about using Rigid body for this as the drag applied would cause a more realistic turn, But this time it looked at the target but carried on in a straight line. But i kept with rigid body ways to keep the gravity and drag for the most realistic missile.


after a while I came up with using a mix of rigid body methods and transform ( Rigid body takes into account physics and collisions, where as transform does not ) and came up with a realistic turn.

A playable demo, Press tab to target and F to switch to HellFire missiles: (Have to give a sound warning here aswell)


This demo also showed a bug, If you fire at the first tank it will start to go around indefinitely it because it didn’t turn in time, Which means i would have to come up with a detection system or a time limit for this type of occurrence.




Leave a Reply

Your email address will not be published. Required fields are marked *

four − = 0