OnComponentHit fired lots of times

Im wondering if it’s possible to detect an initial hit. And by hit, i don’t mean overlap.

My scenario is a destructable mesh that “explodes” the debris eventually hits the ground and possibly the player.

When they hit the ground i get LOTS of OnComponentHit events and i only want to react to one of them (the initial contact). How do i set that up?

I’ve demonstrated this here: Week 2: UE4.9 Dropping animation of magazine + playing with sounds when chunks hit ground - YouTube

Please let me know if you can suggest a different approach, since i think it must be pretty heavy on cpu processing all those unnesseary hit events.

Given the amount of spam I’m guessing you’re getting a hit per each time the rubble bounces.

Not sure how you have this setup, and I haven’t used destructible meshes at all, but here’s what I would look into …

If you only want to register hits on player then set collision type to only collide with the players type. You still chance multiple hits on the player though so you will probably want a custom function on the player to check how recently it’s been damaged by terrain before dealing more.

Hi Distul, and thanks for taking your time to answer my question.

About the amount of hits, i made a lot of tests of this, and it seems that i have 25 pieces of rubble, but i get well over 150 hit events, and judging from the amount of hit lines (visible on the video), something else must be up too…

Regarding my goal of this. Actually i want to register when each chunk hits the ground (and the player), for two reasons:

  1. to render some dust/play a sound of stones falling
  2. to register damage to player if velocity/weight is over a certain amount

My question could also be: How do i only register physics chunk hits over a certain amount of force?

You’re definitely getting a hit per bounce, per debris. As mentioned I’m not very familiar with destructable meshes so you may have to make an array of the meshes when they separate (if that’s possible) and check if each item in the array has already been processed for hits.

Not 100% sure on how to go about this without having a setup myself, sorry.

I have tested this several times now and also tried just printing out a message when i hit another mesh. It will keep firing over and over as long as im in contact with it, which is the case with the falling rubble. It wont just bounce off with one hit. So how have other people solved this?