Spheretrace for AI melee Attack


I have a enemy who chases and melee,s when they get close enough but I am unsure how I do a sphere trace only to “detect” a collision between the player and the enemy when they swing their arm.

I added a socket to the enemy,s skeleton to use as a “detection” point and made a Montage Notification point.

The Blueprint is here. - > AttackPlayer > | PasteBin For Unreal Engine 4

I can see that the Sphere Trace is working because of the all the red spheres but I only want it to show a red sphere when the socket collides with the player but as you can see its doing a red sphere for the entirety of the attack animation.

Any help is greatly appreciated!!

Many thanks!

Hi @Barrabutus
Set the Spherecollision drawing to none, SphereTraceByChannel | Unreal Engine Documentation
use the boolean output to know if hit something, if it does, draw a debug sphere with same size and location.

Many thanks for the reply,

Should I use On Notify Begin or On Completed as, or the Exec pin ?

Its saying it,s colliding with nothing in the blueprint if i put a Branch after the Spheretrace and when i breakpoint on the Spheretrace it all shows as false on the boolean valyes which I guess means that it hit nothing.

Updated Blueprint : Updated Melee > | PasteBin For Unreal Engine 4

I guess the red circle is to indicate that the “body” of the enemy is colliding with the player but the socket on the hand is not for some reason, Do i need to add a sphere collider to the enemy roughly around where the socket is on the enemy mesh model ?

I put the spheretrace back to Persistent because I couldnt see any red circles to detect any collisions.

I also tried using the Exec pin (This caused my Enemy to raise his hand and detect multiple collision and not even finish the animation montage)

I tried using On Notify Begin and this resulted in my Enemy doing the animation once and saying “collided with nothing”

If i use the On Completed node only the animation does repeat and only shows the one red circle.

Once again really appreciate the help!!

PS Sorry if I am being a complete newbie here only started UE about 2 months ago.

Anyone any ideas please?

I am still stuck trying to figure out if i need to add a collider to the “socket” area on my enemy for it to only detect the collision between the enemy and character,
Also why the On Notify Begin does not fire when the playhead reaches the notify section during the animation?

Any replies are appreciated!

I was still stuck on this for ages, For anyone else who may encounter the same issue this is how I managed to work out what was going wrong with mine.

I was using a Normal Notify in the animation timeline and this was not triggering the On Notify Begin in the Play Montage Node, But when I changed to use a Montage Notify this worked and caused the On Notify Begin node to trigger as expected.

So I guess the tip is to make sure you are using the right type of montage trigger notification in your timeline. xD