06-28-2022, 06:27 PM
Hi
The issue you are highlighting does exist, it's not you misconfiguring/misusing the spline.
The issues comes from the fact that Spline.GetTangent does not calculate the real tangent using a mathematical formula for each spline type, but does a delta between two positions which are really close. That gives this unwanted behavior at the CPs.
A solution is to go to the following method in CurvySplineSegment
and add the following after its code contract
I don't like this solution because it is not consistent, it fixes the problem for a type of splines, but not for all of them. Also, it might have side effects I am not thinking of right now.
A solution I prefer is to use the CP's handles, to get exactly the values of the handles (that define the tangents). Those are correct.
Sorry about this issue.
The issue you are highlighting does exist, it's not you misconfiguring/misusing the spline.
The issues comes from the fact that Spline.GetTangent does not calculate the real tangent using a mathematical formula for each spline type, but does a delta between two positions which are really close. That gives this unwanted behavior at the CPs.
A solution is to go to the following method in CurvySplineSegment
Code:
public Vector3 GetTangent(float localF, Vector3 position, Space space = Space.Self)
Code:
if (Spline.Interpolation == CurvyInterpolation.Bezier)
return CurvySpline.BezierTangent(threadSafeLocalPosition.Addition(HandleOut),
threadSafeLocalPosition,
threadSafeNextCpLocalPosition,
threadSafeNextCpLocalPosition.Addition(cachedNextControlPoint.HandleIn),
localF).normalized;
A solution I prefer is to use the CP's handles, to get exactly the values of the handles (that define the tangents). Those are correct.
Sorry about this issue.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.