# Spline mesh and loops

**URL:** <https://forums.unrealengine.com/t/spline-mesh-and-loops/293483>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [September 12, 2014, 1:36am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483 "2014-09-12T01:36:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![OhiraKyou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OhiraKyou](https://forums.unrealengine.com/u/OhiraKyou)\
**Post date:** [September 12, 2014, 1:36am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/1 "2014-09-12T01:36:48Z")

</div>

No amount of spline point rotation will make a spline mesh rotate properly (upside down) in a loop. I am setting the spline mesh component’s start and end tangent in its BP construction script.

Plane:

![15185-splinetwistplane.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/8/6585c14aa669c0988f62e3be49133080c3117994.jpeg)

Cube:

 ![15186-splinetwistcube.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/c/d/5cd27defb6826c28cc4b95e903e11088e44f7a2c.jpeg)

Blueprint:

 ![15256-splinetwistbp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/1/7/117e8710d0fe68a7660741ac7c0f7bb4ae8836ca.jpeg)

---

<div class="post-metadata">

**Author:** ![TJ\_V](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tj_v/32/1008648_2.png) [@TJ\_V](https://forums.unrealengine.com/u/TJ_V)\
**Post date:** [September 12, 2014, 8:06pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/2 "2014-09-12T20:06:28Z")

</div>

Hi OhiraKyou,

Could you also post some screenshots of the Details panel for the Spline Mesh component so we can see how you are calculating the loop?

---

<div class="post-metadata">

**Author:** ![OhiraKyou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OhiraKyou](https://forums.unrealengine.com/u/OhiraKyou)\
**Post date:** [September 12, 2014, 10:23pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/3 "2014-09-12T22:23:36Z")

</div>

I’ve attached my BP to the main post. After the construction script is done, it’s simply a matter of placing points in a loop shape. Points refuse to turn upside down, even while rotating them. Everything works pretty well when the track never goes upside down, but loops and twists are absolutely vital.

Here’s another, simple example:

![15259-splinetwistcube2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/3/e/43ea7065646e66fdce8e7296492b197711f5ded2.jpeg)

---

<div class="post-metadata">

**Author:** ![TJ\_V](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tj_v/32/1008648_2.png) [@TJ\_V](https://forums.unrealengine.com/u/TJ_V)\
**Post date:** [September 15, 2014, 5:19pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/4 "2014-09-15T17:19:46Z")

</div>

Hi OhiraKyou,

Thank you for the feedback. I was able to reproduce the issue and have entered TTP# 346554 into our tracking software. Our developers will be looking into the issue.

I don’t have a workaround at the moment. As soon as I hear back on the TTP we will post back here.

Thanks,  
TJ

---

<div class="post-metadata">

**Author:** ![Dig\_Squid](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dig_squid/32/1145423_2.png) [@Dig\_Squid](https://forums.unrealengine.com/u/Dig_Squid)\
**Post date:** [September 16, 2014, 1:11pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/5 "2014-09-16T13:11:48Z")

</div>

I think you need to play with the ‘SplineUpDir’ parameter. This has to be a direction which the curve will never be parallel to, that the X axis of the mesh will be oriented towards.

---

<div class="post-metadata">

**Author:** ![OhiraKyou](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OhiraKyou](https://forums.unrealengine.com/u/OhiraKyou)\
**Post date:** [September 16, 2014, 5:59pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/6 "2014-09-16T17:59:04Z")

</div>

My tracks curve in every direction ever.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_17ec24a01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_17ec24a01](https://forums.unrealengine.com/u/anonymous_user_17ec24a01)\
**Post date:** [January 7, 2015, 2:10am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/7 "2015-01-07T02:10:59Z")

</div>

I think this is a limitation of UE4 for now, that I am also stuck on. Check out the comments left by sds-michael in this forum thread, he had to fix some C++ in the engine:

> **[\[TUTORIAL\] Create a procedural spline road tool in blueprints 4 part video...](https://forums.unrealengine.com/showthread.php?20194-TUTORIAL-Create-a-procedural-spline-road-tool-in-blueprints-4-part-video-series)**
>
> Hi Everyone I’ve just finished series of video of how to create a road tool using splines. it starts off introducing the new spline and spline mesh components and finishes with using them to create a road placement tool. I did a...

---

<div class="post-metadata">

**Author:** ![mdsf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdsf](https://forums.unrealengine.com/u/mdsf)\
**Post date:** [March 10, 2015, 2:20am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/8 "2015-03-10T02:20:52Z")

</div>

Hey, I have been trying to make a vertical loop and am not sure how “get spline up dir” helps. I’ve tried multiple times adjusting yaw, roll, up direction. Could you please elaborate on the solution?

 ![33390-badspline.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/7/7f7db9db0b49fb90165295d39c535be00d8a646c.png)

---

<div class="post-metadata">

**Author:** ![TJ\_V](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tj_v/32/1008648_2.png) [@TJ\_V](https://forums.unrealengine.com/u/TJ_V)\
**Post date:** [March 10, 2015, 4:59pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/9 "2015-03-10T16:59:58Z")

</div>

Hi mdsf,

The values for the Spline Up Dir generally needs to be experimented with until you get the effect you want. If you’re willing to create a small test project with just the mesh and spline making the loop that you want, I’m happy to help you find the solution.

---

<div class="post-metadata">

**Author:** ![Dig\_Squid](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dig_squid/32/1145423_2.png) [@Dig\_Squid](https://forums.unrealengine.com/u/Dig_Squid)\
**Post date:** [March 12, 2015, 9:38am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/10 "2015-03-12T09:38:30Z")

</div>

The main thing is to find some **direction that the curve will never be parallel to** - that is what you said as the ‘up dir’. The system right now needs some ‘fixed’ direction that it will point the ‘up’ vector towards.

---

<div class="post-metadata">

**Author:** ![Allar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Allar](https://forums.unrealengine.com/u/Allar)\
**Post date:** [March 12, 2015, 9:40am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/11 "2015-03-12T09:40:43Z")

</div>

Any plans on being able to change the up vector along the spline path? I know this isn’t exactly a trivial thing to do.

---

<div class="post-metadata">

**Author:** ![Dig\_Squid](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dig_squid/32/1145423_2.png) [@Dig\_Squid](https://forums.unrealengine.com/u/Dig_Squid)\
**Post date:** [March 12, 2015, 10:20am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/12 "2015-03-12T10:20:59Z")

</div>

You can change the up direction per component, but that will probably cause a discontinuity. It would be a bit expensive to interpolate up vectors I’m afraid ☹

---

<div class="post-metadata">

**Author:** ![mdsf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdsf](https://forums.unrealengine.com/u/mdsf)\
**Post date:** [March 13, 2015, 10:03pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/13 "2015-03-13T22:03:42Z")

</div>

Thanks for the quick response TJ,

I will create a test project and experiment and get back with what I find. Thanks again

---

<div class="post-metadata">

**Author:** ![mdsf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdsf](https://forums.unrealengine.com/u/mdsf)\
**Post date:** [March 13, 2015, 10:04pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/14 "2015-03-13T22:04:14Z")

</div>

That sounds like a good rule of thumb, I’ll see how I can apply it to my project and get back to you.

---

<div class="post-metadata">

**Author:** ![TJ\_V](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tj_v/32/1008648_2.png) [@TJ\_V](https://forums.unrealengine.com/u/TJ_V)\
**Post date:** [March 20, 2015, 3:17pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/15 "2015-03-20T15:17:17Z")

</div>

Hi mdsf,

I just wanted to check up with you. Did you get this working correctly in your project?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6ece94d7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6ece94d7](https://forums.unrealengine.com/u/anonymous_user_6ece94d7)\
**Post date:** [April 13, 2015, 8:50pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/16 "2015-04-13T20:50:15Z")

</div>

It’s a bit of a hack job, but I was able to get loops acting correctly with a bit of math.

From the Get World Direction at Distance Along Spline node, simply Rotate Vector Around Axis. In my case (building a road along a spline), I rotated -90 degrees along the Y axis, then set the resulting value as the Up Dir for the Spline Mesh before doing any other calculations. This ensures that the up vector for any spline mesh along this spline is basically its “normal”.

Here’s a picture of my sloppy blueprint code. The essentials are highlighted.

 ![38606-ue4spline.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/4/e84edfe568dcfd38febcb53e6af1005473b95807.png)

And here are a few pictures of the track in the editor. The red lines are debug draws of the up vectors for each spline mesh (with a length of 200).

 ![38607-ue4track1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/8/82846ecaa97e4a97c4ff23cc48912c29ada255fe.png)

 ![38608-ue4track2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/f/80f2f35ddcb262389fd9dce6717595c893d048bd.png)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Monokkel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/monokkel/32/1194496_2.png) [@Monokkel](https://forums.unrealengine.com/u/Monokkel)\
**Post date:** [June 6, 2016, 11:23am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/17 "2016-06-06T11:23:37Z")

</div>

I’m unable to replicate your results in UE4.12. I’m uncertain if this is because I am missing something or if it is because UE4 now handles spline meshes a bit differently. This thread is a year old and has been marked as solved so I have opened a new thread [here](https://answers.unrealengine.com/questions/429739/problems-with-vertical-loop-on-spline-mesh.html). I’m curious if you are able to replicate your own results in 4.12. If this is too much to ask I wonder if you can tell me what two additional nodes the output from your “Add spline mesh component” are connected too.

---

<div class="post-metadata">

**Author:** ![Lusiogenic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lusiogenic/32/1054664_2.png) [@Lusiogenic](https://forums.unrealengine.com/u/Lusiogenic)\
**Post date:** [December 6, 2016, 9:18pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/18 "2016-12-06T21:18:39Z")

</div>

Thanks for this tip! It works for this case, but if you bend back and forth the same mesh, it does’t work anymore, as the mesh has only one Up Direction.  
Isn’t this a bug?

---

<div class="post-metadata">

**Author:** ![AyanMiru](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ayanmiru/32/1194638_2.png) [@AyanMiru](https://forums.unrealengine.com/u/AyanMiru)\
**Post date:** [January 8, 2018, 7:29am UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/19 "2018-01-08T07:29:31Z")

</div>

Had a setup with spline that updates with cable component particles. Used this solution to fix that nasty twisting. Thank you!

---

<div class="post-metadata">

**Author:** ![RyanGadz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanGadz](https://forums.unrealengine.com/u/RyanGadz)\
**Post date:** [May 25, 2018, 7:53pm UTC](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483/20 "2018-05-25T19:53:58Z")

</div>

I know this is an old post but my plugin is specifically designed to address this issue.

> **[Spline Twist Correct in Code Plugins - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/spline-twist-correct)**
>
> Function library to remove twisting from splines and spline mesh components.

 ![242196-twistcorrectdefault.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/6/d2659c2940c9889e8c996f65000d3b69071270d6.png)

It offsets a second spline so that even when the spline is subdivided you won’t get any twisting.

[Next page](https://forums.unrealengine.com/t/spline-mesh-and-loops/293483.md?page=2)
