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.
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
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
  Angle detection by tangent Skuuulzy 8 4,417 11-28-2024, 09:13 AM
Last Post: _Aka_
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 5,120 04-17-2024, 10:57 AM
Last Post: _Aka_
Question Spline.length incorrect dazz777 3 2,841 10-07-2021, 10:23 AM
Last Post: _Aka_
  Auto Handle from CP tangent Josenildo 3 3,278 05-18-2021, 02:23 PM
Last Post: _Aka_

Forum Jump: