Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tangent incorrect.
#2
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
Code:
public Vector3 GetTangent(float localF, Vector3 position, Space space = Space.Self)
and add the following after its code contract
Code:
if (Spline.Interpolation == CurvyInterpolation.Bezier)
                return CurvySpline.BezierTangent(threadSafeLocalPosition.Addition(HandleOut),
                    threadSafeLocalPosition,
                    threadSafeNextCpLocalPosition,
                    threadSafeNextCpLocalPosition.Addition(cachedNextControlPoint.HandleIn),
                    localF).normalized;
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.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
Tangent incorrect. - by tairoark - 06-27-2022, 08:06 PM
RE: Tangent incorrect. - by _Aka_ - 06-28-2022, 06:27 PM
RE: Tangent incorrect. - by _Aka_ - 06-28-2022, 06:29 PM
RE: Tangent incorrect. - by _Aka_ - 06-28-2022, 06:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 21 04-17-2024, 10:57 AM
Last Post: _Aka_
Question Spline.length incorrect dazz777 3 368 10-07-2021, 10:23 AM
Last Post: _Aka_
  Auto Handle from CP tangent Josenildo 3 1,078 05-18-2021, 02:23 PM
Last Post: _Aka_
  Bezier tangent points constantly change coordinates valyard 3 6,460 02-26-2014, 11:56 AM
Last Post: Jake

Forum Jump: