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 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 set view target with blend node works???

Hi AttemptD,

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

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

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

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

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

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

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