# Line Trace damage with gun not damaging enemy

**URL:** <https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645>\
**Category:** Blueprint\
**Tags:** line-trace, unreal-engine, enemy, Blueprint, question\
**Created:** [August 7, 2023, 4:06pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645 "2023-08-07T16:06:43Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:06pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/1 "2023-08-07T16:06:43Z")

</div>

Hello. I have set up an enemy ai and i am trying to do line trace damage on that enemy with a gun. However, when i do so, the enemy does not take any damage even though i have everything set up. I have attached images below to show

 ![Screenshot (71)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/6/5/465f5db0ba2344a211ce66573b11e8dd8b23f838.png)  
 ![Screenshot (72)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/f/8/cf858b58c13f05b3e14ed9e0c4596166f9058357.png)

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 7, 2023, 4:09pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/2 "2023-08-07T16:09:10Z")

</div>

Can you show us the code for Apply and Receive damage?

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:11pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/3 "2023-08-07T16:11:37Z")

</div>

Hello. thank you for replying. I have edited it to show you a screenshot of the damage system with the linetrace for my gun. if there is any more i can show please tell me

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 7, 2023, 4:14pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/4 "2023-08-07T16:14:49Z")

</div>

Does LineTrace hit your actor? Do Debug Draw

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:16pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/5 "2023-08-07T16:16:10Z")

</div>

please how do debug draw

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 7, 2023, 4:16pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/6 "2023-08-07T16:16:55Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/a/c/aaccf85731547f4ddb9717258137f385744b534e.png)

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:18pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/7 "2023-08-07T16:18:39Z")

</div>

Okay thanks. And please how would i know if it has hit the actor

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 7, 2023, 4:19pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/8 "2023-08-07T16:19:36Z")

</div>

It will show red square on point of impact

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:20pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/9 "2023-08-07T16:20:56Z")

</div>

it shows a red square but not on the actor/ enemy. the line trace seems to be passing through the actor/ enemy

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 7, 2023, 4:23pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/10 "2023-08-07T16:23:02Z")

</div>

That means it doesn’t hit your actor, you need to check that your actor can block cannel that you are using for a line trace

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:24pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/11 "2023-08-07T16:24:14Z")

</div>

oh okay. please how would i go about that

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 7, 2023, 4:25pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/12 "2023-08-07T16:25:41Z")

</div>

First of all, what channel are you using for a line trace.

Second, you can check channels in Collision on the component you want to hit.

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:29pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/13 "2023-08-07T16:29:27Z")

</div>

this is the line trace i am using for the gun damage

 ![Screenshot (73)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/e/5fef532c8fe39a03bc0810638e04fb8155b2439c.png)

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:31pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/14 "2023-08-07T16:31:24Z")

</div>

for the collision for the capsule is there a specific one i will need to change

---

<div class="post-metadata">

**Author:** ![Shunitzo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shunitzo/32/1194547_2.png) [@Shunitzo](https://forums.unrealengine.com/u/Shunitzo)\
**Post date:** [August 7, 2023, 4:32pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/15 "2023-08-07T16:32:50Z")

</div>

You are using visability, so you need to block visability.

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:34pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/16 "2023-08-07T16:34:45Z")

</div>

okay. when i hit the visibility, it gave me a drop down and the other option was camera.

---

<div class="post-metadata">

**Author:** ![Boat\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boat\_K](https://forums.unrealengine.com/u/Boat_K)\
**Post date:** [August 7, 2023, 4:38pm UTC](https://forums.unrealengine.com/t/line-trace-damage-with-gun-not-damaging-enemy/1253645/17 "2023-08-07T16:38:17Z")

</div>

Oh okay i had to go to the collision of the actor/ enemy, and i had to block visibility in collision presets, like you said. It is now working. Thank you for the help
