11-01-2018, 01:50 PM
As explained in the documentation, splineController.Position can have different meanings depending on the value of PositionMode. Since I don't know what value PositionMode your controller has, I will use instead use AbsolutePosition which is independent from PositionMode's value.
CurvySpline.InterpolateByDistance returns the a local position, which means the position of the point in the local space of the spline. I guess that you read the documentation and are aware of this point, since you assigned NextPoint.transform.localPosition, but this is not how you use local positions. You should transform the position from the spline's local space to the global one, and then assign it to NextPoint.transform.position. To transform a local position to a global position, you use https://docs.unity3d.com/ScriptReference/Transform.TransformPoint.html
So the end result should be
var spline = splineController.Spline;
var localPosition = spline.InterpolateByDistance(splineController.AbsolutePosition);
NextPoint.transform.position = spline.transform.TransformPoint(localPosition);
I typed this code outside of an IDE, so it might have some minor typos.
CurvySpline.InterpolateByDistance returns the a local position, which means the position of the point in the local space of the spline. I guess that you read the documentation and are aware of this point, since you assigned NextPoint.transform.localPosition, but this is not how you use local positions. You should transform the position from the spline's local space to the global one, and then assign it to NextPoint.transform.position. To transform a local position to a global position, you use https://docs.unity3d.com/ScriptReference/Transform.TransformPoint.html
So the end result should be
var spline = splineController.Spline;
var localPosition = spline.InterpolateByDistance(splineController.AbsolutePosition);
NextPoint.transform.position = spline.transform.TransformPoint(localPosition);
I typed this code outside of an IDE, so it might have some minor typos.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.