# How to damage a AI or character with Line Trace

**URL:** <https://forums.unrealengine.com/t/how-to-damage-a-ai-or-character-with-line-trace/383638>\
**Category:** AI\
**Tags:** line-trace, damage-player, unreal-engine, UE4, Blueprint, question\
**Created:** [February 1, 2017, 4:51pm UTC](https://forums.unrealengine.com/t/how-to-damage-a-ai-or-character-with-line-trace/383638 "2017-02-01T16:51:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_85b986c61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_85b986c61](https://forums.unrealengine.com/u/anonymous_user_85b986c61)\
**Post date:** [February 1, 2017, 4:51pm UTC](https://forums.unrealengine.com/t/how-to-damage-a-ai-or-character-with-line-trace/383638/1 "2017-02-01T16:51:01Z")

</div>

I am trying to make TPS game and I want to damage ai or any character with line trace and I search everywhere for this but I can’t find. if you can tell me then plz tell…Thanks in advance

 ![124500-screen+shot+2017-02-01+at+7.46.33+pm.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/3/cd3aca62f152b43058943f39828f0f0953f6669e.jpeg)

---

<div class="post-metadata">

**Author:** ![tslimone](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tslimone](https://forums.unrealengine.com/u/tslimone)\
**Post date:** [February 1, 2017, 5:21pm UTC](https://forums.unrealengine.com/t/how-to-damage-a-ai-or-character-with-line-trace/383638/2 "2017-02-01T17:21:13Z")

</div>

Did you check if your line trace was actually hitting your target? You can debug that in many ways, I like to turn on the debug draw from the line trace and/or watch the value of “Hit Actor”.

I might be wrong, but I’d use “Get Forward Vector” instead of “Get RotationXVector”. I never used that second one actually, but if I understood it, you’re getting the direction of the X axis of the controller.

---

<div class="post-metadata">

**Author:** ![StillAlive039](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StillAlive039](https://forums.unrealengine.com/u/StillAlive039)\
**Post date:** [February 2, 2017, 12:35am UTC](https://forums.unrealengine.com/t/how-to-damage-a-ai-or-character-with-line-trace/383638/3 "2017-02-02T00:35:41Z")

</div>

I also have that kind of similar set up and it looks like this.

This is my line trace. After it hit something I take the Hit Actor and cast it to my character to check if it has indeed hit my character and after validating that I would call the damage function on my Character’s Blueprint (which is S39\_Player) and apply damage to that hit character.

 ![124567-line+trace+part+1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/0/380feceb7fe2b50dfa9f2fb7574c11068ad8b93d.png)

I tested the apply damage node in my Project and it worked for me, just add a damage causer in the apply damage node.

---

<div class="post-metadata">

**Author:** ![BPANDREW](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bpandrew/32/1194681_2.png) [@BPANDREW](https://forums.unrealengine.com/u/BPANDREW)\
**Post date:** [February 2, 2017, 2:04am UTC](https://forums.unrealengine.com/t/how-to-damage-a-ai-or-character-with-line-trace/383638/4 "2017-02-02T02:04:16Z")

</div>

to better visualize whats going on - set the debug trace to frame or duration, also check your boolean hit results before applying damage with an if statement

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_85b986c61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_85b986c61](https://forums.unrealengine.com/u/anonymous_user_85b986c61)\
**Post date:** [February 18, 2017, 8:41pm UTC](https://forums.unrealengine.com/t/how-to-damage-a-ai-or-character-with-line-trace/383638/5 "2017-02-18T20:41:59Z")

</div>

I problem is solve. I spawn projectile with line trace and the projectile damage the character and line trace can Also damage character…
