# Draw a line between two actors without using DrawDebugLine

**URL:** <https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [May 27, 2023, 1:31pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314 "2023-05-27T13:31:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [May 27, 2023, 1:31pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/1 "2023-05-27T13:31:41Z")

</div>

Hi!

I’m using Unreal Engine 5.2 with C++ and Blueprint.

I want to draw something like this on a level:

![imagen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/9/e/39e71d40c1f4b982a75449f3b748aeafd7951985.png)

The actors will be 3D spheres. I will put the spheres programmatically with C++ and then add the lines to join each other.

How can I do it?

Thanks!

---

<div class="post-metadata">

**Author:** ![rokenrock](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rokenrock/32/1040844_2.png) [@rokenrock](https://forums.unrealengine.com/u/rokenrock)\
**Post date:** [May 27, 2023, 2:31pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/2 "2023-05-27T14:31:03Z")

</div>

To do this you can simply use DrawDebugLine using the world locations of the two spheres as parameters.

I’ve set the duration to be 0 (it’ll need to be called every frame to be visible) so it’ll update with any change, but if you know how long it’ll be up on screen and don’t want it to change, you can change that duration to be whatever you need.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/6/7e67ed207f07975f312dec80d7ff464e0c08c807.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/8/028bbfeba29b31d6521ac70e89a9a643cfebf5dc.png)

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [May 27, 2023, 3:01pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/3 "2023-05-27T15:01:00Z")

</div>

Thanks, but if I don’t want to use Debug lines. How can I do it?

---

<div class="post-metadata">

**Author:** ![rokenrock](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rokenrock/32/1040844_2.png) [@rokenrock](https://forums.unrealengine.com/u/rokenrock)\
**Post date:** [May 27, 2023, 3:27pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/4 "2023-05-27T15:27:23Z")

</div>

An easy alternative would be using a spline.  
You can use as many points as you want, but to create a line you can just use two with the same rotation  
Here’s a video explaining them:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/2/4/a245569a3bdf9671969513624ed2d63d47f82b09.jpeg "Unreal Engine 4 Tutorial - Splines - Spline Meshes") ](https://www.youtube.com/watch?v=eKIiWa19EMI)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 27, 2023, 3:32pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/5 "2023-05-27T15:32:30Z")

</div>

Depends if the line itself is 2d or 3d. Browse this thread for options:

> [@What are the methods avaiable to draw lines in unreal engine?](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/27):
>
> Thanks for the long talk and giving the information. So in short I can add lines in the project using:- Using lines Using splines using particle beam Using HUD and UMG Using wireframe material Using procedural mesh Using material I guess these are the methods available and for my application spline is the best method to proceed. You can add any final comments if you have. smiley smiley

A ribbon particle could look and perform better than a Spline Mesh Component. But a SMC would give you more flexibility. What method to choose depends on what this is going to be used for.

---

<div class="post-metadata">

**Author:** ![RiveDesign1024](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RiveDesign1024](https://forums.unrealengine.com/u/RiveDesign1024)\
**Post date:** [May 27, 2023, 3:56pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/6 "2023-05-27T15:56:23Z")

</div>

do you want to draw a line in screen space?

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [May 27, 2023, 6:53pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/8 "2023-05-27T18:53:16Z")

</div>

> [@Everynone](#):
>
> Depends if the line itself is 2d or 3d. A ribbon particle could look and perform better

It will be 3D.

I’ll try ribbon particle, but I’m a bit worried about performance because it could be more than ten lines at the same time.

Thanks.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [May 27, 2023, 6:53pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/9 "2023-05-27T18:53:55Z")

</div>

> [@RiveDesign1024](#):
>
> screen space?

Thanks, but sorry, I don’t understand you: What does mean “screen space”?

Thanks.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 27, 2023, 7:21pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/10 "2023-05-27T19:21:39Z")

</div>

I think you could get away with 10k ribbons. They’re pretty fast.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 27, 2023, 7:22pm UTC](https://forums.unrealengine.com/t/draw-a-line-between-two-actors-without-using-drawdebugline/1180314/11 "2023-05-27T19:22:40Z")

</div>

Screen space = 2D. Check the thread I posted, plenty of examples of both.
