A solution to the gimbal lock problem with splines

After many months of searching for solutions to this problem, I ended up rewriting the pipeline for spline mesh creation. Unreal’s default solution relies on a global spline up direction as the basis for calculating twists and rolls, which can cause gimbal lock issues at certain orientations.

USplineMeshComponent’s gimbal lock problem can sometimes be circumvented by changing the spline up vector, but this simply pushes the problem to another axis.

My solution is based on the concept of parallel transport, which maintains a stable orientation along the spline with minimal twisting, defined exclusively by the orientation of control points. This was non-trivial and involved adding some functionality to USplineComponent, a custom mesh component, and work on the shader side too.

Which now lets me do fun things like this, that were not possible before:

Work on this project is still in progress, but I’m happy to answer questions in the meantime.

3 Likes