Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Closest Point on Spline
#1
Hello everyone,

I am new to curvy splines. I want to hop a CurvySpline track that's at the nearest controPoint the gameobject is near.

How am I am able to calculate where to set the SplineController position to?

Also, am I able to access each fragment position between controlPoints?


Reply
#2
Hi

CurvySpline.GetNearestPoint(...) returns the nearest point on a spline.

CurvySpline.GetNearestPointTF(...) returns the nearest point on a spline and its TF value.

To position your spline controller accordingly:
yourSplineController.RelativePosition = nearestTF

More is explained in the documentation of these methods/components. Also, the example scene 05_NearestPoint can be of help if you struggle to use the GetNearestPoint method.

Did this help?
Have a nice day
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a way to get the position of each ControlPoint in spline by API? Chanon 1 145 06-07-2025, 09:44 AM
Last Post: _Aka_
  12_Train junction point richardzzzarnold 5 649 04-16-2025, 02:19 PM
Last Post: _Aka_
  Filling a closed spline dynamically rickgplus 1 368 04-16-2025, 08:56 AM
Last Post: _Aka_
  OnAfterControlPointAdded - Control Point is null jh092 5 859 02-04-2025, 09:31 PM
Last Post: _Aka_

Forum Jump: