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?