# Help With Line trace math

**URL:** <https://forums.unrealengine.com/t/help-with-line-trace-math/2687870>\
**Category:** Programming & Scripting\
**Tags:** linetrace, unreal-engine, vector, Blueprint\
**Created:** [December 26, 2025, 6:49pm UTC](https://forums.unrealengine.com/t/help-with-line-trace-math/2687870 "2025-12-26T18:49:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![teradore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@teradore](https://forums.unrealengine.com/u/teradore)\
**Post date:** [December 26, 2025, 6:49pm UTC](https://forums.unrealengine.com/t/help-with-line-trace-math/2687870/1 "2025-12-26T18:49:40Z")

</div>

hello! so I’m working on trying to add line traces that measure things Infront of the camera in an array, when I start the game the rotation of the vector is correct, however I need them to stay in line relative to the camera rotation and direction. the second the camera moves, the rotated line trace goes crazy and dose not stay in line. I’m sure its something to do with the math/my understanding of vectors but I’m not sure exactly what is going wrong. the plan is eventually to have a ton of these line traces that have distance measurements for whatever is in front of the camera in a way that simulates the way an IRL item measures distance.

any help is greatly apricated, thanks!

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/5/8/4585e7fa60326f6e4fb8423257ee2e2b6a938193.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 27, 2025, 8:27am UTC](https://forums.unrealengine.com/t/help-with-line-trace-math/2687870/2 "2025-12-27T08:27:49Z")

</div>

I did a post here, about how to line trace in all directions

[https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/14](https://forums.unrealengine.com/t/how-to-line-trace-in-all-directions/572301/14)

---

<div class="post-metadata">

**Author:** ![AlienRenders](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienRenders](https://forums.unrealengine.com/u/AlienRenders)\
**Post date:** [December 27, 2025, 5:57pm UTC](https://forums.unrealengine.com/t/help-with-line-trace-math/2687870/3 "2025-12-27T17:57:40Z")

</div>

Yeah, if you want two line traces… one straight ahead from the camera and one that is 10 degrees to the right, the math is way off.

For the first line trace, you need to add the camera position to your forward vector to get the end position. The second part, I’ll just give you a screenshot. I think if you click on it, you’ll get a larger version.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/4/024e1d6ef4a6589e161450b85155d1d3125cdc34.png)

---

<div class="post-metadata">

**Author:** ![teradore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@teradore](https://forums.unrealengine.com/u/teradore)\
**Post date:** [January 2, 2026, 4:00am UTC](https://forums.unrealengine.com/t/help-with-line-trace-math/2687870/4 "2026-01-02T04:00:36Z")

</div>

Holy Crap! not all hero’s wear capes! thank you so much! this works perfect!
