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
  Spline Issue Leading to Unity Freeze Pankaj09 1 329 08-24-2026, 11:28 PM
Last Post: _Aka_
  Connecting Multiple Spline Nodes Issue Ritesh Kadam 1 285 08-22-2026, 11:24 PM
Last Post: _Aka_
  Spline Spots from 2 samples. BitBlit 8 1,352 06-30-2026, 11:49 AM
Last Post: _Aka_
  Best way to duplicate a spline with an offset Kapistijn 8 2,754 04-12-2026, 03:18 PM
Last Post: _Aka_

Forum Jump: