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.
When I try to do a looping, a bug on the deformation occurs, as shown here:
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:
This the expected behaviour (did it on modeling software):
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.
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?
answered Oct 07 '14 at 07:43 PM
TJ V ♦♦ STAFF
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.
answered Mar 16 '19 at 06:56 PM
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.
The local variables in the screenshot were used to avoid recalculation of the normalizations and dot product.
answered Apr 02 '19 at 10:20 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here