# Drawing Spline Runtime

**URL:** <https://forums.unrealengine.com/t/drawing-spline-runtime/1699426>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Spline, runtime, Blueprint\
**Created:** [February 19, 2024, 11:25am UTC](https://forums.unrealengine.com/t/drawing-spline-runtime/1699426 "2024-02-19T11:25:40Z")\
**Posts on this page:** 5\
**Page:** 1

<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:** [February 19, 2024, 11:25am UTC](https://forums.unrealengine.com/t/drawing-spline-runtime/1699426/1 "2024-02-19T11:25:40Z")

</div>

![DrawingSpline](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/e/47e016100c110fdaed5ee23e99d44591355bd1c9.gif)

While working on my runtime editor, I periodically received user requests about the ability to draw runtime splines. I recently finished this feature and would like to share some of my findings. I have also attached a project you can download and use in your work. [Download](https://drive.google.com/file/d/1z7bKhWxv_zek8_BiNbaJHNBOR5r9kZj_/view?usp=drive_link)

The first problem I had to solve was displaying thin lines. Fortunately, I already had some experience in this area, so after some research, I chose a spline mesh component and a wireframe material with a coordinate mask.

![M_SplineMasterPreview](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/5/a8579787e93727060e7927df0cfe436a08d088b7.jpeg)

![M_SplineMasterDomain](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/4/ed457fc4a3d26af704f986ec9b0bfbe7d0c10f79.jpeg)

![M_SplineMasterUsing](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/0/d3088f1422d627884f4f4fb457609052930a7b64.jpeg)

 ![M_SplineMasterGraph](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/c/6/fc6d326bc86bdfaf478105d01387f10f46ebda7e.jpeg)

Since we have the material, let’s draw a debug line with the duration. To do this, I created an actor that builds a line and destroys itself with a given delay.

![DrawDebugLine](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/3/2c3779906fb2dfdd256615359f8ffc19150d606b.gif)

 ![DebugLine](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/e/a7ee3936300f28e5ba8f83b3d456dacb1f49daff.jpeg)

Next, let’s display some spline in runtime — for example, a circle.

(You can see the function of constructing a circle by downloading the project.)

![DrawCircle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/6/9265b9993d92f73c1c043c8b6ac7ca5f13d60e78.gif)

 ![MakeVisibleSpline](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/2/c42d4d2a70799e3600644a158ac4e29a41d5348f.jpeg)

I use the ‘AcquireSplineMeshComponent’ function to reuse existing components instead of creating new ones.

 ![AcquireSplineMeshComponent](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/b/f3b6a4e0dfab97515e58d91c9dea76ce90dc57e3.jpeg)

Then I remove extra components:

 ![RemoveExtraMeshes](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/b/a7baf6d95cac8b87afc432dd2042420491cc1ff7.jpeg)

 ![DrawCircle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/f/3cf0d42a7bef013c6bbb3255b22d7c0aa99f6441.jpeg)

To change the radius:

 ![SetRaidus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/e/5bede22d226422a2487f6996b742408a20c9ca2d.jpeg)

The next step is to draw a spline by points.  
To display the spline, I use the same functions above.  
On start I turn on inputs to receive mouse events. When finished, I turn off the inputs, trim the last point, and update spline meshes.

 ![StartFinishDrawingSpline](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/4/f64e25126b5da57a657f7b98af0b833af533ccbd.jpeg)

 ![MouseInputs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/2/f12e6acdf717e7a307c870601ff2936a10b4c829.jpeg)

 ![AddPoint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/6/e76b54ef9a485d18a8945667158b86fdadb6a1c6.jpeg)

 ![MakePoint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/2/b/a2b83b1c3356cd244f3c2b95d6a0c96f9a85e58e.jpeg)

If Left Shift is pressed, the next point will be linear.

While drawing, I update the last spline point position and the last two spline meshes every tick.

 ![Tick-Refresh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/3/923407537b04e2cb52167c7d0f7b62aa17fc9a58.jpeg)

 ![GetInteractPointPosition](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/5/0/c50b4711dde28acd2fb7e4028f58ef8778f702cd.jpeg)

 ![UpdateArriveMesh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/e/f6e85a9a775b8cdd9754ea2d095a16b9e65c748e.jpeg)

 ![UpdateLeaveMesh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/9/0c9f3bbd772459bab09ea16051df6989c1ca673d.jpeg)

This is enough to draw a spline at runtime.  
However, much more can be achieved:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/0/7a041dee25263ebc550cd0b830dafd8c828f0e7d.jpeg "Quiet Runtime Editor 3.0 - Spline System") ](https://www.youtube.com/watch?v=hcH70SyT04s)

I will add additional material about working with splines.

- How to edit a spline using points and bezier curves.
- How to control the visibility of a spline.
- How to work with spline collisions.
- Meshes along a spline with offset

These and other features are implemented in my Runtime Editor:

> **[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 3.0

---

<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:** [February 27, 2024, 11:20am UTC](https://forums.unrealengine.com/t/drawing-spline-runtime/1699426/2 "2024-02-27T11:20:52Z")

</div>

**Torus:**

![Torus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/0/2/a0257030d08abadd0c7507b7dfde64a02b2fdfc7.gif)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/c/99cf027cdd8bdee0da28ee739ca3c3847be15f6f.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/b/82b8cfdf8d622c7f68e77ce897ccdecbc69cc693.jpeg)

Example Project:  
[DrawLineExampleWithThickness.zip](https://forums.unrealengine.com/uploads/short-url/pWOEwdvCZ3WICuCi56nU1CSn8tJ.zip) (1.0 MB)

---

<div class="post-metadata">

**Author:** ![Axyzz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Axyzz](https://forums.unrealengine.com/u/Axyzz)\
**Post date:** [February 21, 2025, 10:26pm UTC](https://forums.unrealengine.com/t/drawing-spline-runtime/1699426/3 "2025-02-21T22:26:22Z")

</div>

I can’t thank you enough

---

<div class="post-metadata">

**Author:** ![Axyzz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Axyzz](https://forums.unrealengine.com/u/Axyzz)\
**Post date:** [February 25, 2025, 11:45pm UTC](https://forums.unrealengine.com/t/drawing-spline-runtime/1699426/4 "2025-02-25T23:45:53Z")

</div>

Do you have any ideas on implementing line thickness? I’ve looked everywhere but haven’t found a way to modify the wireframe thickness.

---

<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:** [February 26, 2025, 9:27am UTC](https://forums.unrealengine.com/t/drawing-spline-runtime/1699426/5 "2025-02-26T09:27:38Z")

</div>

I don’t know how to achieve that. However, if you turn on Responsive AA, the lines become a little thicker and more apparent.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/e/7bee2939bd04ee99deedc7cee1916f9f2291bbab.jpeg)
