Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetNearestPointTf
#3
In the following line:
spline.GetComponent<>(CurvySpline).Add(firstObject.transform.position, secondObject.transform.position);
the Add method takes local positions, and you are feeding it with global positions.

I would recommend you to use Curvy 7 or newer, and use the methods (Add, GetNearestPointTF, ...) that have an additional parameter called space and that allows you to define whether the input/output is in the local space or global one.

Also, instead of writing:
float nearestTf = spline.GetComponent<CurvySpline>().GetNearestPointTF(inversePositionOnSpline);
Vector3 positionForSphere = spline.transform.TransformPoint(spline.GetComponent<CurvySpline>().Interpolate(nearestTf));
You can write
float nearestTf = spline.GetComponent<CurvySpline>().GetNearestPointTF(inversePositionOnSpline, out Vector3 positionForSphere);
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
GetNearestPointTf - by DunchaLin3 - 09-27-2020, 03:28 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 05:21 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 05:31 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 05:32 PM
RE: GetNearestPointTf - by DunchaLin3 - 09-27-2020, 06:03 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 11:11 PM
RE: GetNearestPointTf - by DunchaLin3 - 09-28-2020, 06:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Looping splines and GetNearestPointTF Sacryn 1 209 10-13-2021, 02:07 PM
Last Post: _Aka_

Forum Jump: