Spline mesh and loops

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

Cube:

Blueprint:

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?

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

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

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.

1 Like

My tracks curve in every direction ever.

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:

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?

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.

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.

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.

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 :frowning:

Thanks for the quick response TJ,

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

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

Hi mdsf,

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

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.

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).

Hope this helps!

1 Like

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. 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.

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?

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

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

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

1 Like