Actor look at spawned actor
I'll try keep this as short as possible, i'm making a tower defense game and i have managed to implement the spawning of the enemy ai and navigation. I have also managed to make my tower cannon face my player with Find Look at Rotation for testing, now i need to find out how i can get my tower cannon to face the nearest enemy ai which has spawned and ran by it (i have the range covered).
or in short, how do i get one actor to face another actor which has been spawned?
asked Mar 08 '15 at 02:08 PM in Blueprint Scripting
I can't test this out atm but you could try having a sphere component to your tower. Also create an Variable of Actor Array. Have Begin Overlap Event from the Sphere Component. When an enemy enters the sphere, add it to the Actor Array. This is so that you can track multiple enemies enter the tower range. Now get the tower to target the first index of the actor array. Before the turret shoots, check if the target is valid, if it isn't, it means the actor has died. Remove the element from the array and target the next one. Now you also need a End Overlap Event event from the Sphere Component to remove the enemies from the Actor Array when they exit the Sphere Component which is your range. This is just an ideal.
Also, if you go to the Learn Tab of the UE4 Launcher and scroll down, you can download the Strategy Game Content Example which I think is a tower defense game. You could see how they did it, thought they may have used c++ for that mechanic. Check it out!
Follow this question
Once you sign in you will be able to subscribe for any updates here