Problems with vertical loop on spline mesh
I am having some trouble making vertical loops for spline meshes. The basic problem is that spline meshes in Unreal Engine will twist 180 degrees if they are bent in a vertical loop. This is a problem that has been solved before here, but I am having trouble implementing the solution I am unsure whether to attribute this to me not understanding it or if later updates have caused this solution to no longer work, and I hope someone in the community can help me find out what I've missed.
The other thread is a year old and marked as solved and I have not been able to contact the guy who solved it the last time, which is why I am opening a new thread. One difference between my blueprint and the one in the other thread is that I get the tangent at distance along spline instead of direction at distance along spline. Using distance no longer seems to work, but this might also be the reason why I am not seeing identical results to the other thread.
My setup for generating a spline mesh is very standard and work exellently for anything but vertical loops. Here is a screenshot of the construction script of the actor containing the spline and one showing the twisting that happens when entering a vertical loop:
Following the solution provided in the thread linked to above I have added a couple of extra node that rotates the up direction of each spline mesh so that it equals its normal, like so:
This works perfectly as long as all points are aligned along the same axis, but as soon as I move some of the spline points in the axis perpendicular to the main direction of the spline everything breaks down and all spline meshes are rotated incorrectly in relation to adjacent spline meshes.
I have been able to get the pieces to line up correctly by modifying the construction script so that I can manually change the start roll of each spline mesh segment, but is an inelegant and tedious solution for something it should be possible to automate.
Does anyone know what I might have missed in attempting to fix this problem? I am out of ideas on how to solve this so any help would be greatly appreciated.
asked Jun 02 '16 at 10:21 PM in Blueprint Scripting
I have been working on this for half a week. After many different attempts, I figured out how to get the correct roll for the spline mesh component. I am working in UE 4.13.1.
First, I use the get up vector at distance along spline node instead of rotating the tangent upward. I also get the up vector at the middle point of where I want to place the spline mesh.
Get Average Distance macro.
I use the rotation to get the roll relative to the new up vector of the Spline mesh component. You need the roll of both the start and end of the spline mesh. Also, the start and end roll for the spline mesh use radian instead of degrees so you have to convert it first.
The get relative roll at spline point function. I use the direction vectors since the get relative transform did not work for some reason. (as did many other things I tried)
And finally creating the spline mesh component.
This method also gives you the ability to roll your spline points and have the spline mesh follow that roll. So you can bank in turns or make corkscrews.
I hope that this helps you or anyone else with this problem.
answered Oct 06 '16 at 01:39 PM
I can t believe noone actually thanked lispink for this AWSOMENESS, and also that it s not marked as a completed answer - First it s extremelly well Scripted. 2nd it s a very smart approach of a hack. 3rd it s very generous. I came today to this problem myself. And went for a similar approach, but I would have never thought of unrotate vector (witch I dont understand the logic). Though I ve plugged the roll to the rotation of the spline point (degrees to rad) as an addition to the system so you can loop and bank at the same time.
@lispink, are u actually working on something ?
answered Dec 04 '18 at 10:40 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here