How to make a simple homing missile
This is a small guide into making a simple target-seeking missile. Start off by creating a rocket: the LBP2 missile object or the one from the Metal Gear Solid DLS are perfect for this (set acceleration to 0%, but leave it switched on for a nice smoke trail), but you can make your own as well. It doesn't even need to be a missile. Killer bees are fine, too.
For the convenience of this guide, point your missile upwards.
http://i.imgur.com/cVwa3.jpg
Now we put a microchip on it and put the following logic on it:
http://i.imgur.com/zQfAV.jpg
The Rotator will point our missile to its target, while the Mover will give it a continuous forward motion. Make sure the Mover is set to an Up value, instead of the default sideway one, and Local Space (so it will move into the direction it is facing). Give the Rotator a large trigger radius.
N.B.: in case you are using the existing missile objects, you can choose to leave out the Mover and rely on the missile's own engine instead.
Per default, the missile will follow the nearest player, but if you tweak the Rotator to aim for a tag, you can have it chase other specific targets as well. Stick an emitter to a dark matter platform and have it spit out missiles to see it in action. With these settings we now have a missile that is almost impossible to dodge; it is very fast and way too manoeuvrable.
You can go two directions with this:
- If you set the Mover to a high speed, then you should set the Rotator speed to a low value; the missile will reach its target very fast but isn't very accurate unless the target is a fast mover himself as well - this is like a real homing missile. The missile also needs a lot of space for this. It is ideal for a flying game.
- If you set the Mover to a low speed, then the Rotator speed can go up. The missile will not be as fast and you can avoid it if you are faster. It will, however, make very short turns and be always on your tail. Works best in small, closed environments.
http://i.imgur.com/kK5fN.jpg
There is a chance that your missile will make endless circles around a target that, due to its Rotator settings, it cannot reach. For a more fulfilling gameplay experience, you can have the missile blow itself up after a short while. A timer hooked up with a Destroyer will do that for you.