# OnComponentHit.AddDynamic for subobject component not firing

**URL:** <https://forums.unrealengine.com/t/oncomponenthit-adddynamic-for-subobject-component-not-firing/2337595>\
**Category:** C++\
**Tags:** unreal-engine, Collision, CPP\
**Created:** [February 16, 2025, 9:53pm UTC](https://forums.unrealengine.com/t/oncomponenthit-adddynamic-for-subobject-component-not-firing/2337595 "2025-02-16T21:53:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GreenBaguette192](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GreenBaguette192](https://forums.unrealengine.com/u/GreenBaguette192)\
**Post date:** [February 16, 2025, 9:53pm UTC](https://forums.unrealengine.com/t/oncomponenthit-adddynamic-for-subobject-component-not-firing/2337595/1 "2025-02-16T21:53:52Z")

</div>

Hello again, somewhat beginner game programmer here. I have a player character with subcomponents that I want to use to detect hits with. The detection will fire an OnHit function within the main player cpp. I’ve done everything I can to check syntax, set generates hits to true on all components, and stuff like that. But not a single log message comes through. Can someone see what I’m missing?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/3/c/43c84571549ecf4e55b32c6251be1f4fedd5ad66.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/6/5/c6555422d81d29a79da0a2a6ceddf4f0a81f484c.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/c/7cc346f67bf7ff275ef9b1d47292947a0b7af4b9.png)

I’m also wondering if it could be something to do with the hierarchy of objects or if maybe the hitbox isn’t actually moving with the player. I feel like since ourArm-\>SetupAttachment and stuff like that works would mean otherwise, but who knows.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/8/e48602e6b4bb8c7281db045f9ea7dca8e283ce20.png)

Any help is super appreciated. I’m really confused because my classmate has a similar setup I’ve referenced, and other than setting physics to true (which I really don’t want for this object), everything seems to be the same. It’s his box object I’m trying to hit.

---

<div class="post-metadata">

**Author:** ![GreenBaguette192](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GreenBaguette192](https://forums.unrealengine.com/u/GreenBaguette192)\
**Post date:** [February 18, 2025, 3:04pm UTC](https://forums.unrealengine.com/t/oncomponenthit-adddynamic-for-subobject-component-not-firing/2337595/2 "2025-02-18T15:04:10Z")

</div>

I have adjusted this to use OnComponentBeginOverlap (with the appropriate parameter corrections) instead and have done  
ourArm-\>SetGenerateOverlapEvents(true);  
but it still does not want to trigger.

The arm is set to object type vehicle and overlap everything. The other object is set to world static and block everything _except_ overlap vehicles. Both generate overlap events.

I don’t know whats going on except maybe all the subcomponents are confusing it. As far as I can tell, everything matches and it should work. Adding screenshots of everything in case somebody catches something I missed.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/0/2/3025195fc094cbffdf29ae389432022372e50626.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/2/cd2a640d2fb316dfdff6e5eebd0788b27fdf3e7a.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/2/1/a210a9e9e3f4d2543eef7e2759bae4cfbde2f870.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/8/0a881070698ebd977e3b1e7da696e90f9816d67a.png)

---

<div class="post-metadata">

**Author:** ![JonathanBengoa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JonathanBengoa](https://forums.unrealengine.com/u/JonathanBengoa)\
**Post date:** [February 18, 2025, 6:18pm UTC](https://forums.unrealengine.com/t/oncomponenthit-adddynamic-for-subobject-component-not-firing/2337595/3 "2025-02-18T18:18:55Z")

</div>

Hey @GreenBaguette192

Some question about your Component is a UPrimitiveComponent?  
Can you show me the header of your componente?

Looks like you component doesn’t have bounds.  
You can do a quick check changing the parent to box component to see if you the overlap works.

---

<div class="post-metadata">

**Author:** ![GreenBaguette192](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GreenBaguette192](https://forums.unrealengine.com/u/GreenBaguette192)\
**Post date:** [February 19, 2025, 5:25pm UTC](https://forums.unrealengine.com/t/oncomponenthit-adddynamic-for-subobject-component-not-firing/2337595/4 "2025-02-19T17:25:10Z")

</div>

The subcomponent/object is a UBoxComponent, so I definitely feel like it should have bounds.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/5/1/55129fbebce78b9ddc40c17a3b085f9b3b36e743.png)  
I wasn’t sure exactly what you meant about the parent, but I tried setting armHolder to a UBoxComponent and it still did not detect overlap.

---

<div class="post-metadata">

**Author:** ![GreenBaguette192](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GreenBaguette192](https://forums.unrealengine.com/u/GreenBaguette192)\
**Post date:** [February 20, 2025, 2:07am UTC](https://forums.unrealengine.com/t/oncomponenthit-adddynamic-for-subobject-component-not-firing/2337595/5 "2025-02-20T02:07:59Z")

</div>

Resolved!!! Had to be in BeginPlay, which is strange because my classmates is in his constructor. Not complaining though!
