The design for this weapon started as an alternative for Doom Eternal's Full Auto shotgun mod. I wanted to add some depth to what is normally just a DPS weapon that lived or died by how much damage it dealt. I came up with the idea of a weapon where the primary fire would be normal shotgun rounds (fully automatic or not), while the alt fire would fire a "magnetic spike" that stuck into enemies.
The implementation above uses a projectile that fires toward the center of the screen. When it impacts an enemy, it reparents itself to the enemy and rotates itself toward the point of collision to create an "embedded" effect. Hitting an enemy with this spike marks it for the homing bullets. Initially I only had the bullets home in, but this didn't add much depth to the weapon as it only made a "homing shotgun", which didn't improve its functionality at all. To add more depth, I decided to add a second spread of bullets that homed in. The result of this is a weapon that gives more decision making a use cases to a player: they can mark a target to make it easier to hit them and improve the DPS by firing twice the amount of bullets, or they can mark a high health enemy and then focus on smaller health enemies, turning a single-target DPS weapon into a weapon that has more cleave potential.
While I'm happy with the design itself, the major issue I had was implementing a homing hit-scan bullet, as I needed to check if the bullets would impact a wall while curving towards the enemy. The above implementation raycasts straight short distances before rotating slightly toward the enemy. While this works, it ends up looking too stilted. Luckily due to my unhappiness with this implementation, when I began work on a catapult enemy I did a lot more research and learned about Bezier curves. If I were to re-implement this feature I'd 100% use what I did for that, as it gives a much smoother looking path in a much easier way.