# What are the methods avaiable to draw lines in unreal engine?

**URL:** <https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [September 22, 2022, 10:57am UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052 "2022-09-22T10:57:20Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 1:45pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/21 "2022-09-22T13:45:42Z")

</div>

Yes in my case the lines must be occulded as it will be beginning from the front of the car i.e from hood. So while viewing it must be occulded and only show it fully when i chnage the camera angle. So i think i can’t able to use HUD and UMG as it always are on top of the screen, am I right ?

---

<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:** [September 22, 2022, 1:55pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/22 "2022-09-22T13:55:25Z")

</div>

> [@ronyshaji1](#):
>
> So i think i can’t able to use HUD and UMG as it always are on top of the screen, am I right ?

They draw on top of geometry, yes. And HUD actually draws on top of UMG if I remember correctly. HUD and UMG are 2 different things - just to clarify.

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 1:58pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/23 "2022-09-22T13:58:20Z")

</div>

Thanks for the clarification.

Is there any way i can extend the creation of spline with c++ ? Do you have any idea as i need to iteratively change the values of the rectangle while simualtion starts?

---

<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:** [September 22, 2022, 2:06pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/24 "2022-09-22T14:06:32Z")

</div>

Yes, you can. It’s all dynamic. Luckily, YT is choke full of spline tutorials.

* * *

One note, since you’ve yet to dive into UE4’s splines, when the coordinates of spline points are updated, the mesh that represents a spline segment (via a Spline Mesh Component) does not follow and update automatically.

If you alter the spline, you need to adjust the meshes. This is generally a non-issue unless you decide to do it every frame for 100s of cars. It’s not exactly cheap under those circumstances.

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 2:10pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/25 "2022-09-22T14:10:07Z")

</div>

Now I got a slight confusion. When we add a spline component, does the spline mesh creates automatically and attaches to it or do we need to create a spline associated with thr spline.

“If you alter the spline, you need to adjust the meshes.” - Here I got the doubt.

---

<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:** [September 22, 2022, 2:13pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/26 "2022-09-22T14:13:38Z")

</div>

Spline is a component and can have many points. For each pair of points, you will need a spline mesh component. For the _white_ spline here:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/2/e/a2e61f3d3a7bcbb0d6f627d5dbf457e7b585be0b.jpeg)

You’d need 4 spline mesh component. They can (and should!) be added dynamically. Do look up tutorials - this is a topic that has been covered extensively.

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 2:16pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/27 "2022-09-22T14:16:56Z")

</div>

Thanks for the long talk and giving the information. So in short I can add lines in the project using:-

1. Using lines
2. Using splines
3. using particle beam
4. Using HUD and UMG
5. Using wireframe material
6. Using procedural mesh
7. 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. 😃 😃

---

<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:** [September 22, 2022, 2:20pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/28 "2022-09-22T14:20:29Z")

</div>

Material, you could draw lines directly in material:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/3/e/33e6250b3e26fca82c9d336d8b0923ceccf54831.jpeg "UE4 Tutorial - Create 2D Line with Material") ](https://www.youtube.com/watch?v=LYiwUfC1I3w)

Since it’s a material, you can slap it on anything you want - texture the sides of your projection pyramid, for example; and since this is a shader, it’s very efficient and immensely customizable.

An approach that takes a lot of upfront work, though.

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 2:23pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/29 "2022-09-22T14:23:30Z")

</div>

Yea I updated the list based on your comment. Hope using the material doesnot affect the physics as i mentioned earlier.

---

<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:** [September 22, 2022, 2:25pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/30 "2022-09-22T14:25:10Z")

</div>

> [@ronyshaji1](#):
>
> Hope using the material doesnot affect the physics as i mentioned earlier.

It has nothing to do with physics. Disable collision on the mesh that represents the projection:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/d/c/8dc3a6ea35273ae2ce4b7995fbcea52e5613f528.png)

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 2:26pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/31 "2022-09-22T14:26:49Z")

</div>

Thanks i will try and get back to here if got stuck in between. Thanks again for your help and time 🤩

---

<div class="post-metadata">

**Author:** ![Supremative](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/supremative/32/906564_2.png) [@Supremative](https://forums.unrealengine.com/u/Supremative)\
**Post date:** [September 22, 2022, 2:30pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/32 "2022-09-22T14:30:20Z")

</div>

I use a Procedural Mesh Component and wireframe material for a similar effect. In the material, I mask the inner edges of the polygons to avoid triangulation.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/5/d25edc61e4c069bb855925214d49188e26195b43.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/c/2/dc2047494c04d5c96b401144a7d02ff8c5fa0560.jpeg)

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/d/b/5db80698e8cf89b351f8d44adeeb1ad9b305659d.jpeg "Quiet Runtime Editor – Build Scene") ](https://www.youtube.com/watch?v=S8t4r1YHjYY)

> **[Quiet Runtime Editor in Blueprints - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/quiet-runtime-editor)**
>
> Quiet Runtime Editor is designed to build and edit 3D scenes runtime. Version 2.0

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 2:34pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/33 "2022-09-22T14:34:51Z")

</div>

You used procedural mesh and wireframe material together for the pyramid or just the procedural mesh for the pyramid ?

---

<div class="post-metadata">

**Author:** ![Supremative](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/supremative/32/906564_2.png) [@Supremative](https://forums.unrealengine.com/u/Supremative)\
**Post date:** [September 22, 2022, 2:39pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/34 "2022-09-22T14:39:39Z")

</div>

I create and modify a pyramid with a procedural mesh. Wireframe material shows needed edges.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/e/18e907ab60e89c9e745492b5f2efc136207f72da.png)

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 22, 2022, 2:43pm UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/35 "2022-09-22T14:43:01Z")

</div>

Yea thanks for the insight. This is a completely new method for me and thanks for sharing. I will try once

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 28, 2022, 7:18am UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/36 "2022-09-28T07:18:44Z")

</div>

Hi @Everynone

I got a doubt in the continuation of the topic. How can I get the location of a component attached to a blueprint. I want to start the line from the location where i attached a component. How to get that location ?

---

<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:** [September 28, 2022, 7:26am UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/37 "2022-09-28T07:26:05Z")

</div>

> [@ronyshaji1](#):
>
> How can I get the location of a component attached to a blueprint. I want to start the line from the location where i attached a component. How to get that location ?

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/0/ea094ede8351402ea2a3e78dbe868715ad70f689.png)

Depends on whether we’re working in world or relative space.

---

<div class="post-metadata">

**Author:** ![Supremative](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/supremative/32/906564_2.png) [@Supremative](https://forums.unrealengine.com/u/Supremative)\
**Post date:** [September 28, 2022, 7:27am UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/38 "2022-09-28T07:27:17Z")

</div>

If you have a ref of your component, get its world location:

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

---

<div class="post-metadata">

**Author:** ![ronyshaji1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ronyshaji1](https://forums.unrealengine.com/u/ronyshaji1)\
**Post date:** [September 28, 2022, 7:28am UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/39 "2022-09-28T07:28:49Z")

</div>

@Supremative Yes thankS i got that and do you have any idea what to give in the context of draw line as without it the line is not visible.

 ![BP_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/8/8a8c36d9bf5069f8f5e5de3d1b4892f6a6206495.png)

---

<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:** [September 28, 2022, 7:31am UTC](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052/40 "2022-09-28T07:31:34Z")

</div>

You can’t convert it like this. If the Component is at `25000, 25000, 0` and you point the camera there, you can see it in the viewport, sure. But if you try to draw a pixel at `25000, 25000` - there is no such pixel. Your monitor’s X ends at what - 1920 or 3440?

Try this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/c/05cb989f57b289a90d06d356e830cffd4d0da9da.png)

There’s 3 or more nodes that do _almost_ the same thing.

[Previous page](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052.md?page=1)

[Next page](https://forums.unrealengine.com/t/what-are-the-methods-avaiable-to-draw-lines-in-unreal-engine/654052.md?page=3)
