How to add randomness in homing projectile.
Hello. I have setup a system where enemy shoots a projectile to the player. I am using blueprint and setting the current player homing component of the enemy projectile. The issue is the enemy is shooting accurately every time to the player how can i add some randomness or missing feature to homing projectile?
asked May 24 '18 at 03:50 PM in Blueprint Scripting
You can make a "dumb" homing missile by having it store the player's current location as a vector variable when the projectile is first spawned, and it homes in on THAT location. If it requires an Actor to home toward, you can create a bare bones base Actor and spawn it at the player's current location.
Then the missile will home in, but only toward where the player USED to be if the player moves.
Option 2 is a smarter homing missile but you create a random offset range away from the player so that sometimes it is trying to home in on a spot that's not exactly where the player is, but near it.
Option 3 you could create a base actor to use as the homing target like in option 1, BUT the base actor is always lerping toward the player's actual position, with a delay. That way the more evasive maneuvers the player makes, the further the target point will be from leading the missile to the player;s actual position.
Another option is you can simply adjust the homing acceleration on the projectilemovement component of the missile so that it can't turn fast enough to catch up with the target's evasions.
That last one is probably the easiest way to do it, if your missile uses the projectilemovement component.
answered May 24 '18 at 06:49 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here