Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

SplineMesh bug when doing looping

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 end point and end rotation.

alt text

When I try to do a looping, a bug on the deformation occurs, as shown here:

alt text

This seen to be gymbal lock ocurring during the deformation.

If I set the roll to 180 degres to get the ending upside down, the problem get worse:

alt text

This the expected behaviour (did it on modeling software):

alt text

Is there a way to solve this? Or is it realy a gymbal lock bug due to internal calculations using euler angles instead of quaternions?

Using UE4.4.1 binary version.

Product Version: Not Selected
ue4 1.png (785.9 kB)
ue4 3.png (790.9 kB)
ue4 2.png (787.4 kB)
ue4 4.png (112.9 kB)
more ▼

asked Oct 07 '14 at 05:50 AM in Bug Reports

avatar image

71 8 9 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Hi Jandex,

In the Details panel > Spline Mesh > Play with the values for "SplineUpDir". This will usually correct most of these twisting issues.

If it doesn't, could you post your asset so we can test it further?



more ▼

answered Oct 07 '14 at 07:43 PM

avatar image

41.1k 1009 183 493

avatar image Jandex Oct 08 '14 at 03:48 AM

Thanks TJ Ballard for the answer. But I think tweaking UpDir doesn't solve it. Just moves the problem to another situation. For example, I changed Up to (0 ,1 ,0) , and got this:

alt text

I can do loop but can´t do a curve. If I put (1 ,0 ,0) I can do curve and loop, but can´t do straight line. I short, the problem always occurs when the spline direction gets aligned with the Up Dir.

Maybe a solution would be having a Start Up Dir and End Up Dir, and interpolate those along the spline. This would replace the roll parameter. Or there may be a better solution.

Here is the link for the assets.

ue4 5.png (439.2 kB)
avatar image TJ V ♦♦ STAFF Oct 09 '14 at 02:46 PM

Hi Jandex,

So here is the solution I came up with. I made a slight twist using the SplineUpDir and then adjusted the Start & End Roll values. If you set the values as I have pictured below it should work.

alt text

alt text

avatar image sds-michael Oct 09 '14 at 11:29 PM

Thanks for this! I'm currently going through the same issues and this solved them.

avatar image Jandex Oct 21 '14 at 10:51 PM

Sorry for the delayed response. I was away from the computer these days. Thanks TJ Ballard for the help, but this doesn't solve it.

Let me be more clear of what I'm trying to achieve. I want to create a tool to create a racing track F-Zero style. My ideia is to have a sequence of deformed spline meshes conected one end to the start of the other. Those spline meshes should be manipulated by gizmos in the editor. I would have a start transform and end transform for each spline mesh, and the spline mesh should interpolate between those transforms.

The problem is, due to the method used to deform the mesh by spline, whenever the spline aligns with the up vector the mesh twists around it self. Don´t matter what up vector I put, if the track goes in there direction there will be this unwanted twists.

My issue is not with one specific case that will work, but is to have a tool that will behave properly in all cases.

Here is the link to download the Spline Track Blueprint with Widget manipulators for you to test it. Add one instance to the level and try moving and rotating the end Widget.

(obs: I also submited another bug due to Widget gizmo orientation)

avatar image TJ V ♦♦ STAFF Oct 28 '14 at 09:24 PM

Ah okay, I see what you mean now. I don't believe this is currently possible with SplineMeshes but it could be fixed if the 'Spline Up Dir' was exposed like the rest of the values in blueprints. A variable could be created and made public, this would allow each blueprint to be adjusted as needed.

I created a Feature Request in our tracking software for this and our developers will be looking into it further.



avatar image Jandex Oct 28 '14 at 09:53 PM

Thank you very much! I will stay tuned for it in the next updates

avatar image TJ V ♦♦ STAFF Jan 09 '15 at 04:33 PM

Hi Jandex,

This has now been fixed in our latest internal build. You should see a 'Get Spline Up Dir' and a 'Set Spline Up Dir' node in a future update.



avatar image Genova Jun 18 '17 at 01:12 AM

Geeze... I feel like a total idiot... I've been struggling with a similar issue (the infamous gimbal lock) for a long time and assumed that was inherently unavoidable without using quaternion. Had to work around that using convoluted solution... Feels good to know there is an easy fix.

avatar image roberteker Jan 28 '19 at 02:10 PM

I still see the twist in 4.21.2. Tweaking the "up vector" does not solve the issue, only moves it around.

avatar image gurankas Feb 15 '19 at 05:17 AM

@roberteker There's a property called Default Up Vector for the spline mesh in the details panel. Play with the values and it should un-twist itself. Had the same issue and I tweaked the X value to around -200 and the twist solved itself.

avatar image roberteker Feb 15 '19 at 10:55 AM

That does not work when you have a full loop and other twists on the same spline.

I had to purchase a marketplace asset that was able to have individual up vectors per spline point.

It's really quite poor of Epic to leave this flaw in for several years.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi , I have been trying to create a procedural splineMesh using spline component and adding splineMesh to that component depending upon the number of spline points , which of course most of us would do. while doing so i got this twisting issue ,i tried to look for solution , well none of it worked for me. But i found out it is related to spline Mesh Up vector ,so basically i will need to update spline mesh up vector , but there are so many spline meshs i just need to do it for each one individually. I found a plugin which was desgined for this kind of problem which will allow you to edit each spline mesh Up vector indivually. so i thought of implementing it myself and it works like charm .

Maybe it will help you guys too.

I have used an array of vector which is InstanceEditable and desgined to have number of items in array equilaent to number of spline meshes. Then i have updated each spline mesh's up vector from that Array , so basically i can control each splineMesh UpVector individually.|

This is how i have done this . sorry for congested Nodes in Bp , this is the only way i could get this in a single ScreenShot.

alt text alt text alt text

spliness2-1.png (633.1 kB)
spliness2-2.png (17.3 kB)
spliness2-3.png (17.0 kB)
more ▼

answered Mar 16 '19 at 06:56 PM

avatar image

18 1 2 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I solved the twist with an automatic calculation of an Up Direction for each spline mesh.

I calculate the direction as a cross vector of the start and end tangents. It only fails if the tangents are parallel vectors, in which case I made a conditional that shuffles the components of the first tangent, giving me a perpendicular vector to both tangents.

Then I just apply this vector to the Spline Mesh using its Set Up Direction function. That way I don't have to manually decide the up vectors myself.

alt text

The local variables in the screenshot were used to avoid recalculation of the normalizations and dot product.

more ▼

answered Apr 02 '19 at 10:20 PM

avatar image

1.1k 28 39 90

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question