How to set up hit events for a physics body or other collision

I want to have a static mesh projectile do different things based on what it hits and where it hits it.
The projectile is an Actor composed of:

① static mesh

② capsule component

③ projectile movement component.

Currently the player, enemies and the projectile has box collision on the parts I want special behavior. I created 3 object channels; Projectile, Player, Enemy. Set the projectile to Overlap Player and Enemy, and Player and Enemy to Overlap Projectile.

I then set up OnComponentBeginOverlap Events for player and enemies. It works perfect with Overlap Events, but I’ve no idea how to set it up to work with Hit Events.

Why Hit Events?
From what I’ve researched, overlaps can’t give me hit location. (I’ve no idea why I can’t use the Sweep Result on Overlap…)

Do I need to use physics bodies to get Hit Events? I ticked simulation generates hit events & Physics & Query Collision enabled on all of the existing collision boxes that work perfect with overlap, and set up an oncomponentHit on them but they never get fired. Also changed object responses accordingly; projectile to Block Player and Enemy, and Player and Enemy to Block Projectile.

I can provide any screenshots needed!

Honestly, I’ve never been able to get those darn hit events working. I’ve never tried that hard because I’ve always been able to use Overlap instead.

But try isolating the problem as far as possible. Create two new actors as basic as possible with just colliders and try to get the two of them to fire hit events.

If it works, then figure out what went wrong, or what settings were changed, etc.

If it still doesn’t work… well… At least its easier to mess around with clean empty actors because there’s nothing to loose or anything getting in the way.

Not very helpful, but hope it helps!

There is a component called “projectile movement”. You should use it in your projectile-like actors. It’s much more reliable. It handles the “projectile stop” event type which is very important in creating correct behaviors for bullets and such. Also it benefits from higher-rate refreshment for physic events which is mandatory when trying to do something like “real” bullets, which usually go too fast for the engine to detect collisions and overlaps properly (happens between ticks and it’s a hassle).

Also, check the documentation on hit events and the basic template of FPS projects. It should provide some insight on how to handle your projectiles properly.

Best regards, Khannarc

1 Like

Thanks a lot for the help, Willard720 and Khannarc.

I’m in the process of remaking the projectile from scratch to see if I can get the hit events. (I’m basically using a combination of both of your guys’ suggestions.) I’ll report back if I can fix it with that.

Many thanks!

Good news. I got it working by using the On Projectile Bounce in the projectiles event graph. That gives me the hit info.

Weird thing is I only need to generate Hit Events on the projectiles collision. Receiver doesn’t need it. Overlaps for both were left on (default).

Created custom collision capsule on the static mesh, added a box collision to the things I want to react to it.