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 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
  How to choose which model to use for each segment? itzikpel 1 5 04-21-2022, 02:03 PM
Last Post: _Aka_
  Variable mesh extrusion offset per segment CrushedPixel 1 12 12-23-2021, 10:40 AM
Last Post: _Aka_
  Split existing segment(s) with additional control points KStress71 1 279 09-09-2021, 05:46 PM
Last Post: _Aka_
  Rotation of Curvy Spline Segment jh092 1 1,348 05-31-2020, 09:36 AM
Last Post: _Aka_

Forum Jump: