Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Monotonically increasing segment F
#1
Hello,

   I'm using the SplineController class to navigate a spline with constant speed. While the object is on a specific segment I want to get the local segment F and drive some other system with it and I want the F to move at constant speed between 0 and 1 on the segment. I'm using SplineController.Spline.TFToSegment to get the local F.
   The problem is the sampled local F values form a curve like this, when plotted, instead of a straight line:
[Image: 6WBA4.png]

   Is there any way to get a monotonically increasing local F?

Thanks
Reply
#2
Hello
F isn't necessarly proportional to distance. Please read this for more details
https://curvyeditor.com/documentation/splines/start#units
The API has some convertion methods like CurvySplineSegment.LocalFToDistance
Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Hello,

Thanks for the reply, Aka. I'm posting a small follow-up in case anyone else needs this.
The solution is:
Code:
float positionOnSegment;
CurvySplineSegment segment = Spline.DistanceToSegment(SplineController.AbsolutePosition, out positionOnSegment);
float percentageOnSegment = positionOnSegment/ segment.Length;
TL;DR convert from absolute distance to percentage

Have a nice day
Reply
#4
thanks
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
  Is there a way to extrude a bit past a spline segment? Lupos 1 6 05-09-2023, 09:55 AM
Last Post: _Aka_
  How can I remove one segment of the road that I made by spline? Chanon 3 7 09-14-2022, 04:44 PM
Last Post: _Aka_
  How to get Split Length to match spline segment length? dromo 4 29 07-21-2022, 10:04 PM
Last Post: _Aka_

Forum Jump: