# mario hit brick

**URL:** <https://forums.unrealengine.com/t/mario-hit-brick/2631961>\
**Category:** Blueprint\
**Tags:** unreal-engine, editor, Blueprint, CPP, question\
**Created:** [August 6, 2025, 9:58am UTC](https://forums.unrealengine.com/t/mario-hit-brick/2631961 "2025-08-06T09:58:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dozzirik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dozzirik](https://forums.unrealengine.com/u/Dozzirik)\
**Post date:** [August 6, 2025, 9:58am UTC](https://forums.unrealengine.com/t/mario-hit-brick/2631961/1 "2025-08-06T09:58:50Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/0/4209fd036370a93f9e346548c0208de58bb66bf3.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/3/403d47321d1b35c217cc47405ea58f021444a98c.png)  
in my mario game i want to spawn coin only if i hit bottom of the brick. it spawn coins if i hit from side ways when i jump. how can i control this too?

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [August 6, 2025, 10:22am UTC](https://forums.unrealengine.com/t/mario-hit-brick/2631961/2 "2025-08-06T10:22:34Z")

</div>

the easiest way is to just put a box collision component in the exact area you want,

otherwise if using math you have to realize that the actor location is ‘usually’ the center of the mesh. so the center of the character is lower than the center of the brick on sideways too.

you can use bounds to check if the top of the character is lower than the bottom of the brick or just use box collider

---

<div class="post-metadata">

**Author:** ![Dozzirik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dozzirik](https://forums.unrealengine.com/u/Dozzirik)\
**Post date:** [August 6, 2025, 11:38am UTC](https://forums.unrealengine.com/t/mario-hit-brick/2631961/3 "2025-08-06T11:38:24Z")

</div>

thank you sir box collision component worked. I would like to do it with math too

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [August 6, 2025, 11:53am UTC](https://forums.unrealengine.com/t/mario-hit-brick/2631961/4 "2025-08-06T11:53:19Z")

</div>

math you have 2 choices,

you can check if the actor is below like you have but it would be  
note this is pseudo code  
BrickActorZLocation-BrickActorZHalfHeight \> ActorLocation+ActorHalfCapsuleHeight

or you can use the DotProduct to compare how closely the hit direction is to the world UP Vector.

---

<div class="post-metadata">

**Author:** ![Dozzirik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dozzirik](https://forums.unrealengine.com/u/Dozzirik)\
**Post date:** [August 6, 2025, 11:54am UTC](https://forums.unrealengine.com/t/mario-hit-brick/2631961/5 "2025-08-06T11:54:45Z")

</div>

very good thank you. i ll give a try
