Trouble figuring out spline Roll

Im trying to figure out how to avoid occasional splinemesh twists. So from my understanding we have to set Up Dir (which is for the start), and then calculate the roll. The formular as far as i can figure out, should be something like getting an angle between the start and end point in the spline, and since the spline itself don’t have a rotation, im trying to use construct an upvector from the tangent of each point.

This should give me two vectors to work from which i can then crossproduct to get the orthogonal vector. The dot product between should in theory give me the angle that i need, but setting the Up Dir causes it to make some big holes in the spline.

Did anyone figure this out properly? And by that, i mean not just so that it works most of the time, but always.

See an extreme example along with the blueprint setup i have right now producing this horrible result.

As a side note: If i don’t touch the Up Dir and leave the Roll at zero, it looks just fine, in 90% of the cases, but eventually i get twists along my spline. Also since this is procedurally generated, i can’t assume any fixed Up Dir, since it will change through out the spline randomly.

1st, did you set the “Forward Axis” for the “Add Spline Mesh Component” Node to X? I can see you set it to Z, which usually not the case.

2nd, I can see you didn’t use any “Attach To Component” node after the creation of the spline component, which is kinda essential step too.

I would recommend you to go through a video like this one quickly, and I’m sure your problem will be solved right away :slight_smile:

Since my “cylinder” is pointing in the Z direction, i should use the Z axis, so unless some of that logic is somehow bugged, it should be correct. I’ll try to flip it in 3dsmax though. Attach To Component is only needed if i uncheck manual, i tried that in a different setup too. As i tried to clarify, i did try all the obvious problems, and without doing anything at all with the Up Dir and Roll, it will look like this (slightly different example)

As this picture shows, everything looks ok, but once in a while i’ll get something like this:

Hopes this clarifies what i try to build and what my problem is.