Homing Missles WIP

Currently working on Fine tuning my homing missiles. They work great when targets are far from the player, but things get strange when they’re in them middle of the screen. Sometimes they like to swim around targets as you see here. For the most part it clears the screen quite well.
How It Was Done
So what you’re seeing here is the projectile simply being scripted to move in one direction and adjusting its rotation towards any object with a enemy tag.
I originally had it where the position of the lasers would also move towards to the enemy, but it started to conflict with the change in rotation. Which cause my lasers to spaz out like salt shakers.
Overview

This is the universal laser script that I use for the current existing projectiles in game. Everything was scripted in Update() and the firing modes are separated by a IsHomming bool.
The script will populate an gameobject array with as many enemies that are in game. It will then pass through two if statements that will check if there are enemies. After thats concluded, it will either remain in a straight line or move and rotate towards a random enemy game object.
Assignment

The game object will initially grab all enemy game objects in game and store it into an array. We then use the populated array to assign a game object a random game object from the array. We do this so that our missiles may go after multiple targets than for the same target.
Chase

After assignment, itll then begin chase after a enemy. It’ll first check if the enemy’s Y position is greater than -3 then drive and rotate into the enemy’s direction.
Timed Destroy

Additonally, the lasers are destroyed in X amount of seconds rather than going beyond a certain boundary. I had a couple of missiles do donuts on my screen for a good 2 seconds. Visually appealing, but not desired.
Wrap Up
Ill be working further fine tuning the projectiles logic along side of others things.
Also here’s a sneak peak of a limited burst fire secondary ability that im working on. The single homing lasers will be replaced by this and return back to shooting straight.
