# How to replace a line trace by a Mesh Renderer Niagara? 

**URL:** <https://forums.unrealengine.com/t/how-to-replace-a-line-trace-by-a-mesh-renderer-niagara/2401191>\
**Category:** FX\
**Tags:** unreal-engine\
**Created:** [March 19, 2025, 4:52pm UTC](https://forums.unrealengine.com/t/how-to-replace-a-line-trace-by-a-mesh-renderer-niagara/2401191 "2025-03-19T16:52:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gingertomy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gingertomy](https://forums.unrealengine.com/u/gingertomy)\
**Post date:** [March 19, 2025, 4:52pm UTC](https://forums.unrealengine.com/t/how-to-replace-a-line-trace-by-a-mesh-renderer-niagara/2401191/1 "2025-03-19T16:52:34Z")

</div>

Hello, i’m creating a laser turret and I created a Mesh Renderer Niagara. Is there anyway to modify its rotation and length to touch the line trace goal? I want to avoid using a ribbon niagara…

---

<div class="post-metadata">

**Author:** ![BRS\_GerDAngelo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brs_gerdangelo/32/1009628_2.png) [@BRS\_GerDAngelo](https://forums.unrealengine.com/u/BRS_GerDAngelo)\
**Post date:** [March 20, 2025, 7:50pm UTC](https://forums.unrealengine.com/t/how-to-replace-a-line-trace-by-a-mesh-renderer-niagara/2401191/2 "2025-03-20T19:50:48Z")

</div>

Hi @gingertomy  
Let’s see…

Do a Line Trace: Get the start and end locations from the trace

Calculate the Direction & Length:  
Use vector math to get the direction and distance (length) between the start and end locations.  
Direction = Normalize(EndPosition - StartPosition)  
LaserLength = Distance(StartPosition, EndPosition)

Calculate the Rotation: Use a LookAtRotation (or similar) to get the rotation from start to end location

Utilize in Niagara System:  
Utilize LaserLength to use as mesh scale  
Set mesh rotation according to the computed LaserRotation.  
Update the Mesh Renderer: Ensure that the Mesh Renderer of the Niagara System uses variables for length and rotation to respond dynamically.

This function will have the laser mesh align with the line trace target without using a ribbon
