Projectile bounces off Character, but never returns any Hit events

I started from a blank project and currently have a Projectile actor which uses the ProjectileMovementComponent. I’ve wired up the OnHit delegate like so:

You can see that I’m using both OnActorHit and OnComponentHit – I was just using OnComponentHit originally, but added OnActorHit after I wasn’t getting anything printed to the log (to no avail).

This is how I’ve set up my OnProjectileHit function:

It should print something to the log, damage the thing it hit, then destroy the projectile. However, instead it’s just bouncing off the player, never writing anything to the log. I added another print function to show the weapon being fired – you can see that despite me firing the weapon multiple times (spawning a Projectile each time), I never see that hit message.

I’ve set up Simulation Generates Hit Events on both the Capsule Component wired up to the Character and the Projectile’s Sphere Component. I can see the Projectile bouncing off of the player, and if I change the collision settings on the Projectile (either in Blueprint or in code), I can see those collision settings reflected ingame.

Here’s my Character’s Capsule Component collision settings:

And here’s my Projectile’s Sphere Component collision settings:

Is there something obvious I’m missing here? I’ve been tearing my hair out over this for the past 2 days straight. Before I wrote any code, I made a prototype of this completely in Blueprints (starting from the First Person Example project). If anything I had the opposite problem there, where my projectiles were generating too many Hit events. Now, I started a fresh, blank C++ project with the goal of making the “real” game, and I can’t even get them to generate one. What gives?

Fixed the issue. You can’t bind delegates in the constructor; you need to do it in BeginPlay or PostInitializeComponents (where I wound up doing it). Moving the AddDynamic calls there fixed the issue.

1 Like

Thanks dude, you saved my life. It’s still weird tho, and it actually is possible to make it work setting it in the constructor, as I had it working that way initially. But it was weird, I got for some youtube tutorial in which: it was temporarily setting some other (scene)component as the root, then the delegate function was set, and afterwards it was made the root. I think it can’t be set when it’s set as the root. Just documenting it here, in case someone deals with this stuff.