# Hit Events From APEX Destruction Chunks

**URL:** <https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494>\
**Category:** World Creation\
**Tags:** Destruction, unreal-engine, UE4, question\
**Created:** [May 24, 2017, 5:35pm UTC](https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494 "2017-05-24T17:35:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [May 24, 2017, 5:35pm UTC](https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494/1 "2017-05-24T17:35:59Z")

</div>

I am specifically interested in getting OnComponentHit or EventHit responses when a CHUNK of a destructible actor is involved in a blocking hit.

My cursory search on UDN found a few unanswered questions with similar titles and a slew of bug tracker issues that seem related:

- [Unreal Engine Issues and Bug Tracker (UE-27061)](https://issues.unrealengine.com/issue/UE-27061)
- [Unreal Engine Issues and Bug Tracker (UE-34420)](https://issues.unrealengine.com/issue/UE-34420)
- [Unreal Engine Issues and Bug Tracker (UE-34953)](https://issues.unrealengine.com/issue/UE-34953)
- [Unreal Engine Issues and Bug Tracker (UE-35356)](https://issues.unrealengine.com/issue/UE-35356)

A few of these are related to impact damage being disabled. I am fine with enabling impact damage in this particular instance; though that is a nuisance if you want hit events regardless of impact damage being on.

* * *

**Research**

The arresting factor I’ve found is inside the function `FPhysScene::DispatchPhysNotifications_AssumesLocked` where `NotifyInfo.bCallEvent0` is false when `NotifyInfo.Info0.Actor` is a destructible actor.

The source of that value is In `FBodyInstance::AddCollisionNotifyInfo`. Where the `bBody0Notify` boolean is set to ` (FilterFlags0&EPDF_ContactNotify) != 0` where obviously the constant `EPDF_ContactNotify` is unmatched in the bitfield.

Perhaps there is some way for me to force the `FilterFlags` value to enable that bit in the bitfield? My attempt at calling `SetMaskFilter(EPDF_ContactNotify)` on the destructible component’s body instance didn’t change the bits set on the body instance returned by `Body0->GetOriginalBodyInstance(Shape0)` which are assigned to `FilterFlags0` so perhaps attempting that on a destructible component directly isn’t doing what I expect.

**Questions**

1. Is there an out of the box solution that will get me hit events on individual apex chunk blocking hits?
2. If there isn’t something out of the box could you point me towards the engine source where I could make a change?
3. It was mentioned in a previous question of mine that there is a new destructible interface forthcoming (Blast) is that being released soon?

With regard to the last question it’s been challenging to search an issue and find an entry in the bug tracker marked backlogged or won’t-fix because new features are coming soon but with no release date announced.

---

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [May 24, 2017, 5:36pm UTC](https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494/2 "2017-05-24T17:36:08Z")

</div>

Hi Connor,

There’s nothing as simple as just getting the chunk from a collision, but there should be two fields on FHitResult that will identify what was hit. BoneName should have some identifying information in it, as will Item. Item looks like it gets the chunk index which is populated in SetHitResultFromShapeAndFaceIndex in CollisionConversions.cpp. So if you can get the apex actor you should be able to extract your chunks from there.

Benn.

---

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [May 24, 2017, 5:36pm UTC](https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494/3 "2017-05-24T17:36:10Z")

</div>

Hi Benn,

Your answer doesn’t precisely solve my issue. I want to get hit events to fire on the destructible actor that has chunks hitting any surface.

If I followed your answer I could see adding the response logic to any surface that might get hit by a destructible and firing some event BACK to the destructible that I am interested in having events on but that would be costly and counter-intuitive.

Hopefully you can point me in the right direction.

---

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [May 24, 2017, 5:36pm UTC](https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494/4 "2017-05-24T17:36:11Z")

</div>

Sorry Connor I understand now. Have you attempted binding to OnComponentHit or using AActor::ReceiveHit. Those should get you callbacks when the component or actor hits another, with a quick test I was able to track which chunk of a destructible a player was standing on after destruction.

---

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [May 24, 2017, 5:36pm UTC](https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494/5 "2017-05-24T17:36:13Z")

</div>

I’ve binded to both and I can get events when an object intersects with a destructible chunk. However I am more interested in getting a hit event when the chunk is flying around and hits any arbitrary object.

---

<div class="post-metadata">

**Author:** ![Answers.Archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Answers.Archive](https://forums.unrealengine.com/u/Answers.Archive)\
**Post date:** [May 24, 2017, 5:36pm UTC](https://forums.unrealengine.com/t/hit-events-from-apex-destruction-chunks/394494/6 "2017-05-24T17:36:14Z")

</div>

Sorry for the delay, I think I can see why the notify flags aren’t set up correctly. In UDestructibleComponent::OnCreatePhysicsState there’s a call to CreateShapeFilterData which sets up the filter flags. We pass bEnableImpactDamage as the parameter for enabling the notify flag. A quick way to test would be to enable impact damage on your mesh and see if you’re getting more event callbacks.

If this works then you’ll need to change the flag passed to CreateShapeFilterData and possibly make a change to the code which catches the impact damage events if you don’t want that to be enabled (UDestructibleComponent::ApplyDamage and UDestructibleComponent::ApplyRadiusDamage)
