This week we made a missile targeting system for our shmup. This was not too difficult, but I did run into a few issues along the way. To start with we made the missile script that was a child of the projectile script. Then to get it following a target, we gave it a rotation speed and a way to find the closest enemy. To find the closest enemy we needed to test all the enemies for their distance from the missile and take the closest one. However an issue i ran into when implementing this script was making the missile object collider a trigger, so that the projectile script could apply damage and destroy the missile. When making the missile turn towards the target, we created a target rotation that always pointed at the target and then slerped the missile towards that rotation at the rotation speed. This resulted in the missile circling the enemy rather than hitting it. This method was creating a physics-less missile, however, there are of course other ways to do this. One way would be to create a missile with physics that move by adding force rather than transforming forward. Then you could simply make the missile look at the target and its mass would limit its ability to hit the target, not its rotation speed. I think I might take this approach to create missiles that the enemy fires, so that the there is some challenge in dodging the missiles while killing the enemies. This thread shows both ways that I listed with some more detail if you are interested in replicating it. One issue with the current shown methods is that the missiles can target the same enemies, making most of the missiles obsolete. There are a few ways to solve this, but they require much more work. Here is one way to do this.
All these ways are reasonable and it just depends on what type of missile you are looking to have and what purpose it serves. It’s better to have the missiles from enemies be easier to dodge and for the players to be near impossible to dodge.