01-17-2019, 08:36 AM
(This post was last modified: 01-17-2019, 08:39 AM by geekrelief.)
When the control points have changed as the track advances, nextControlPointInitalUp needs to adjust for when the currentOrientationAnchor up vectors are non-zero. Because we want to preserve the up vectors through the parallel transport through the segments. If we change the code to something like:
That should in theory give us the same up vectors for the old segments and produce the proper up vectors for the new segments.
But we also need to modify the code that does the swirl. I don't understand what the smoothingAngleStep calculation does, but I suspect that and the block of code below "Apply swirl" which is updating the update vectors needs a fix. If I comment out the swirl code the meshes are basically aligned though there is a very tiny misalignment.
For now I'll see if I can get away with using Static orientations, the behavior is much simpler and looking at the code probably runs faster too.
Code:
Vector3 nextControlPointInitialUp;
if (currentOrientationAnchor.ApproximationUp[0].sqrMagnitude == 0f)
{
nextControlPointInitialUp = currentOrientation.getOrthoUp0Internal();
}
else
{
nextControlPointInitialUp = currentOrientationAnchor.ApproximationUp[0];
}
That should in theory give us the same up vectors for the old segments and produce the proper up vectors for the new segments.
But we also need to modify the code that does the swirl. I don't understand what the smoothingAngleStep calculation does, but I suspect that and the block of code below "Apply swirl" which is updating the update vectors needs a fix. If I comment out the swirl code the meshes are basically aligned though there is a very tiny misalignment.
For now I'll see if I can get away with using Static orientations, the behavior is much simpler and looking at the code probably runs faster too.