Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to detect bend in a spline or strait part of spline at position
#6
(08-11-2023, 09:58 AM)_Aka_ Wrote: Hi
TF is not proportional to distance. More about this here: https://www.youtube.com/watch?v=rP0zuAEoVJw
It would be best to use GetTangentByDistance
The way you compute the angle is invalid in a lot of cases. You can use Unity's Vector3.Angle, or a custom method if Unity's method is not precise enough.


Thanks so much for the tip! I'm now using this which seems to be working much better: 

                float mTFDistance = Spline.TFToDistance(mTF, CurvyClamping.Clamp);

                Vector3 Cornernow = Spline.GetTangentByDistance(mTFDistance);
                Vector3 Cornercomingup = Spline.GetTangentByDistance(mTFDistance + 0.5f);

                float leanangle = Vector3.SignedAngle(Cornernow, Cornercomingup, Vector3.up);

                Debug.Log("lean angle " + leanangle);
Reply


Messages In This Thread
RE: How to detect bend in a spline or strait part of spline at position - by SAMYTHEBIGJUICY - 08-11-2023, 02:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,289 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 644 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,429 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 6,163 07-13-2025, 07:11 PM
Last Post: _Aka_

Forum Jump: