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/sp...tart#units
The API has some convertion methods like CurvySplineSegment.LocalFToDistance
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Input Spline Path have a CP Range to or across Segment 0 nictringali 2 2,916 03-08-2016, 11:51 AM
Last Post: nictringali
  Different texture for each segment Malachite 1 3,145 08-08-2013, 07:15 AM
Last Post: Jake

Forum Jump: