# Spline - common loop problem

**URL:** <https://forums.unrealengine.com/t/spline-common-loop-problem/366882>\
**Category:** Audio\
**Tags:** splinemeshcomponent, UE4-12, unreal-engine, Spline, loop, bug-report, question\
**Created:** [August 11, 2016, 8:40pm UTC](https://forums.unrealengine.com/t/spline-common-loop-problem/366882 "2016-08-11T20:40:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_447cf1121](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_447cf1121](https://forums.unrealengine.com/u/anonymous_user_447cf1121)\
**Post date:** [August 11, 2016, 8:40pm UTC](https://forums.unrealengine.com/t/spline-common-loop-problem/366882/1 "2016-08-11T20:40:50Z")

</div>

Hey guys. Got the same problem as some others around here when trying to loop with a spline.

UE 4.12

I want to draw splines at runtime, that works nicely. But when looping, I get the rotation problem like others do.

> **[SplineMesh bug when doing looping](https://forums.unrealengine.com/questions/109798/splinemesh-bug-when-doing-looping.html)**
>
> I’m trying to create a racing game with a crazy track with loopings, corkscrews and twists. I using spline mesh to deform track sections. What I want to do is a Construction Script that has a Transform variable with a Widget manipulator to set the...

> **[Spline mesh and loops](https://forums.unrealengine.com/questions/97064/spline-mesh-and-loops.html)**
>
> 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: Cube: Blueprint:

In these threads it is always mentioned to adjust the Spline Up Dir, what somewhat seems to work on these guys. In my case, changing the Spline Up Dir does not seem to have any effect. It´s always the upwars loop that is causing the rotation problem, no matter what Up Dir is set on the spline. Spline Meshes are created on the go when the distance between two Points is to long. A new point is inserted and a Spline Mesh applied.

Here the spline point tangents are set, the spline updated and start and end of every spline mesh is set according to its spline points.

 ![102532-blueprint.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/9/1b9c99c9e26032c53e3c43dbbe479a7ace9bb616.jpeg)

and this is what it looks with debug draw of spline point up vector, ugly rotation at loop still existing

 ![102533-splinedraw.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/8/1f8357f0a49c573dac01b2604b2e523746e47f30.jpeg)

My solution to that problem would be changing the roll of the spline mesh to counter the unwanted spline rotation. But the amount of roll to apply depends on the direction the spline is drawn and the tangent length of the points. Seems impossible to finger out when and what amount of roll to apply to a mesh.

A working example would be nice, there are enough that are in need of one.  
appreciate any help you can give.

best regards

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_447cf1121](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_447cf1121](https://forums.unrealengine.com/u/anonymous_user_447cf1121)\
**Post date:** [August 17, 2016, 1:47pm UTC](https://forums.unrealengine.com/t/spline-common-loop-problem/366882/2 "2016-08-17T13:47:39Z")

</div>

Oook, found my problem with “SplineUpDir”.

In order to make it work, you would need to set the “SplineUpDir” of an “SplineMeshComponent”. NOT the “SplineUpVector” of the “Spline” as shone above.

Would be nice of Unreal would change this to “SplineMeshComponent”-\>“SplineMeshUpDir”. Would make it more understandable.

---

<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:56pm UTC](https://forums.unrealengine.com/t/spline-common-loop-problem/366882/3 "2016-12-06T21:56:17Z")

</div>

This still doesn’t work if the same Spline Mesh Component is bent twice. So it actually limits the use to only small meshes.
