How do I lock fired projectile direction to an enemy?

How difficult would it be to have an option of pressing a button to lock onto enemies in a certain range?? Like first person metroid prime style.

Basically like any other lock on so when the enemy moves ur camera follows it for however long u set it to whatever other reasoning. I use blueprints. …could someone help me?

Thank you!!!

From player controller, i think they have 1 node is Set View Target with Blend, you can check that.

I see it…how exactly would I use that to achieve what I’m going for??

Can anyone explain to me how the set view target with blend node works???

Hi AttemptD,

Try using “Find Look at Rotation”, that should force the function to head directly for the object you set it to.

What if there are multiple enemies??? Is there a way to make it understand to move towards the nearest enemy?

You could use a Get All Actors of Class node with the class of your AI, which returns an array. Do a ForEachLoop and find the location of each, do some basic math to see which is closest, and then use the Find Look at Rotation.

This seems perfect!!! Would it be possible for you to explain the basic math part to me? That’s where I’m confused.

If you have the position of the projectile (GetActorLocation) and you have the array of the enemies you can do something like the following.

http://puu.sh/aQyBK/b923926d7e.png

Set the first Closest Range to something really high so that the branch doesn’t fail the first time the projectile searchs for a target.