Hit events not firing consistently

I have a setup where a thrown ball is hitting a character, and both the character and ball need to respond to this collision event. 90% of the time this is working correctly, however, the other 10% of the time the ball hits the character and bounces off without firing any sort of hit event at all.

What might be happening here? Why would I occasionally not receive hit events for the ball, when it is visibly hitting the character mesh and bouncing off it in a different direction?

Additional info about my setup - the ball and the character are set to block each other’s type, and they are both set to “simulation generates hit events.” The ball is set to “Simulate Physics”, “Use CCD” and “Trace Complex on Move,” and it is intended to hit the character’s mesh, not the character’s capsule.

Hello dforhan,

When it comes to collision, it’s going to be based off the root component and I assume that your root for your character is your capsule component. Is it possible that these 10% times are when the ball is hitting the capsule but not colliding with the actual mesh? This could be the case if your logic is only meant to trigger on colliding with the mesh component itself. If you’re still having trouble, could you provide screenshots of your blueprints’ hierarchies, their collision channel settings and the logic you’re using for your hit events?

It’s possible, but I don’t think that’s what’s happening. I’m handling the hit event in C++, and when the issue occurs, the NotifyHit function on the ball is not called - I’ve tried breakpoints and log statements, and it doesn’t hit either. Attached are my collision/physics settings for (respectively) the character capsule, the character mesh, the ball collision component, and the logic for my collision handling.

The only thing I see odd here is that you have the character’s CapsuleComponent set to Ignore the Grenade collision channel, but still have it set to the Pawn collision channel, meaning that the Grenade is blocking it in return. Can you try setting the CapsuleComponent to also block the Grenade channel and see if the results change? I tested this a bit with NotifyHit(); and just placing a Destroy(); call in it for when my projectile hits anything, but even when messing with the hierarchies, I’m not seeing this issue.

If I set the capsule component to block the Grenade channel, then I do get consistent collisions, but this does not give me the desired behavior, as the ball hits the capsule and not the mesh. I need the ball to collide against the mesh and not the capsule.

There are a couple of reasons for this - one is that there is a “sticky” form of this ball which collides with the character mesh and sticks to the closest bone. This will not function using capsule collision. The other reason is that when other types of ball hit the capsule and not the mesh, it is very noticeable visually.

I will try changing the collision channel on the capsule (or the mesh) so there’s no confusion about whether or not the ball should block the “Pawn” collision channel, and see if that gives me more consistent behavior than my current setup.

I added a collision channel called “CharacterMesh,” set the mesh to it, and set it to block the “Grenade” profile. I changed the “Pawn” profile to ignore “Grenade,” and the “Grenade” profile to ignore pawn, and to block “CharacterMesh”.

Behavior is the same for me as with the setup above, it works around 90% of the time, and the other 10% of the time bounces off the character mesh without generating a hit event.

Would it be possible for you to provide an example project? It doesn’t have to be the full project you’re currently using, as long as it reproduces the issue. I’d like to be able to take a look myself and see if I can find out what the issue is.

If you’d rather send it privately, you can host it on it a 3rd party website and send the link to me through our [forum][1]'s private message system.

[1]:

Hello dforhan, I know you sent me a private message saying you’re working on seeing if you can send me an example project. In the meantime, I’ll be marking this issue as resolved for tracking purposes. Whenever you’re available, please let me know and we can continue.