On Hit Component Not Triggering

I am following the UnrealGaimeDev Skill System tutorial. I am watching this video: [Eng] Ability/Skill Tree System: Creating Magic Missile Spells #18 - YouTube to create a homing missile spell. In the video he creates a spell actor that homes to a target enemy. The spell actor has an On Hit Component for the collision sphere that is supposed to trigger against the collision capsule of the enemy character.

For some reason my On Hit Component event is not triggering. Somehow the spell actor is passing through the enemy collision capsule and actually pushing the enemy character around. Eventually it triggers. Sometimes it triggers when it should. It’s not easily predictable. I’m at a loss.

I have tried many different combination of settings on both the spell actor and the enemy character. The current config is detailed below:

Enemy Character (Parent Class = Character)

Components:


Capsule Component Collision:

Widget Sphere Collision:

Character Mesh:

BP_MagicProjectile (Parent Class = Actor)

Components:
image

Sphere Collision:

You can see the video here:

The projectile just keeps pushing the enemy character around. I don’t believe this is a code issue, because I put a debug point in the On Component Hit (Sphere) in the BP_MagicProjectile event and it never triggers.

I’ve been working on this for several days and I have read several other posts here and elsewhere with people having similar issues. I’ve read their resolutions and none seem to have worked for me.

I would appreciate any help getting this to work! Let me know if you have any questions. Thank you.

Try this.
In Sphere Collision of BP_MagicProjectile,

Check the ‘Generate Overlap Events’,

Set the Collision Response to ‘Pawn’ to ‘Overlap’.

I checked the Generate Overlap Event on both components, then I switched the Collision Response on the BP_MagicProjectile from blocking Pawn to overlap Pawn as suggested.

According to the video tutorial I believe you have to set the channels to “block” or it won’t work. Now when I cast the spell the projectile just passes through to the center of the Enemy actor and stays there generating no event at all (see video)

I have one additional piece of information that may help. Sometimes the event does trigger. It seems to trigger when the projectile traps the enemy between itself and another object that can’t be moved. I reverted the collision channels to the original config and took the video below.


Occasionally it even fires right away like I intended it to, but I can’t figure out what makes it work sometimes and not other times.

I could switch to an Overlap Event system and work around this issue, but I’m stubborn and I want to learn.

I don’t understand exactly what the documentation means by “solid”, does this just mean collision channel = blocked? Is there something else I need to do to make sure my enemy character collision capsule is “solid”?

Thanks again for any help.

Hi there,
Can you show the function check collision to see how it was setup? Also, can you add print string on component hit node, “other component” + get display name + print string, to check if something other than the enemy capsule is being hit ( when it works)?

I added a print statement for Other Actor and it shows “Master_Enemy2” every time.

Also here is a SS of the Check Collision function.

Below is a timestamped location for the tutorial video of where he originally creates the functionality:

I did all his tutorials years ago, and don’t recall any collision issues in that particlar chapter. He uses homing projectile logic, so he checks simulate hit events as true, is homing projectile as true, collision is set to block all dynamic, with includes pawns. Also, homing projectile target requires the arrow component from the enemy BP.
By looking at the screenshot, the branch condition is true only if hit actor is equal to selected target actor. So, isolating your issue, either other actor is null ( which you’ve already tested as always master enemy bp), or target actor is somehow different from other actor.
I would recheck collision settings and print strings for the target actor value, homing projectile settings and all outputs from hit event.

I originally had the arrow component, but in troubleshooting this over the last several days I’ve experimented with some other options. Currently I switched to just setting the homing target to the capsule component. As you can see from the video, it seems to be homing properly.

I know what you’re thinking: there may be a logical error in the function where the actors don’t match and it just skips over destroying the actor. I can confirm that is not happening. I set a breakpoint on Check Collision function entry point and the event just never triggers.

I did print the values just before entering the CheckCollision
image
The print statements are all correct, getting to the print statements is the problem

I also added print statements for the enemy and projectile spawn to check to see if the collisions were messed up on spawn.

Enemy Begin Play


which prints “I am a ECC_Pawn and I ECR_Block world dynamics”
image

Projectile Begin Play


which prints “I am a ECC_WorldDynamic and I ECR_Block Pawns”
image

What constitutes a “hit” event? Is the “hit” event basically the same as the begin overlap event? Should this thing be triggering when the collision cylinder from the enemy and collision sphere from the projectile begin to overlap? Is it when the sphere is completely inside the cylinder?

You can see from the videos that the projectile sphere passes through the collision cylinder. Shouldn’t my settings make that impossible? I have the enemy cylinder set to block world dynamic (same type as my projectile) and I have my projectile collision sphere set to block pawn (same type as the collision cylinder for the enemy). I think answering the question why the projectile sphere is able to pass through the enemy cylinder is the answer.

That’s a very good question. I’ll see if I can reproduce the projectile hit logic and share here if I found anything.

Have you checked the final project for download? Usually the link is shared in the last video of his series. That is also something I’d check, if converting this project to UE5 generated any issues with physics collisions.

I appreciate you taking the time to help.

I actually didn’t know he released the final project. I’ll check the final video and see if I can figure anything out from that.

Normally when I have some sort of issue I check the comments. There was one comment that had the same issue from a massive time span (someone from 3 years back, and someone from 1 year back) You can see the comment below:

They posted their solution here: https://cdn.discordapp.com/attachments/797631092789739530/804852334026686464/unknown.png

This is why I say I’m stubborn. I want to learn why this isn’t working to better understand how the engine works. This person just switched to a begin overlap event, which I’ve used many times before with a lot of success.

I do have one deviation from his tutorial series. As you may have noted, I have a top down character not a third person character. I doubt it, but is it possible that might affect anything?

They’ve switched to overlap events, which I am sure I also used in my previous prototype, but I don’t remember now if I also used hit events.

If I am not wrong, all his tutorials came with project files. It’s worth checking out.

1 Like

Any advice on which to use when and why? IIRC the UE documentation suggested the overlap “for example a player walking into a trigger”. It seems like the “on hit” makes sense for projectile collisions and on overlap would be good for spawn triggers and such.

My plan was to finish up this tutorial series and use it for the basis of a multiplayer VR game. I wanted to go through the work of adapting a system I know to see the differences in SP vs MP and traditional vs VR.

EDIT:
I got to look at his project. His works no problem. Low and behold… He also changes his missile spell to use overlap instead of hit… Maybe he covers this in another video, or discovered issues later? I guess I’ll finish watching the series and move on.


I suppose if it’s good enough for him, it’s good enough for me. Maybe it’s time to give up on Component Hit.

1 Like

Perhaps he did figure out a better way using o overlaps. Hit events also make sense, for instance, for a grenade that explodes on impact. Perhaps it is a combination of factors leading to random failures. I’ll keep a tab on this. Glad to know you are moving on. Keep up the good work.

1 Like