Have an enemy throw an item at the player

So im currently trying to get an enemy ai to throw a spear at the player when they get close enough but i cant figure out how to get it to work, any help would be appreciated (UE4)

1 Like

Hello! Welcome to the forums. This is a pretty vague post since we don’t have any idea how your current implementation is setup. Is there anything you can show for your AI enemies so we can go off a bit more?

What I can give you for an idea to start right now though, is to have your enemy have an overlap sphere (or box if it’s preferable) and use the on overlap functionality to check for the player character type you have and then do your throw spear functionality.

You can then also have them stop throwing by using the On End Overlap Functionality as well. Hope this pushes you in the right direction. :grinning_face:

1 Like


this is how its currently set up, however it doesnt move to the player, it moves to the left of the enemy in the world.

ideally id like it to essentially launch at the player though

Hey @Spirits_Shade, Welcome to the forums!

If you have the spear be a seperate actor, that would make this even easier. You can use “Suggest Projectile Arc” and have it use that for launch velocity.
Here’s a tutorial for that from Matt Aspland!

Disclaimer: This link is not affiliated with Epic Games, Unreal Engine, or their partners.

Hope that helps, let us know if you run into any additional issues!