Hi,
Glad you are liking Curvy Splines.
Various points:
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Glad you are liking Curvy Splines.
Various points:
- When adding the first control point of your spline, using InsertAfter or InsertBefore doesn't make sense, since their are no other control points. Prefer using the Add() method.
- When computing targetDirection, you substract two positions, one in local coordinates and the other in world coordinates. That's not good. Use world coordinates for all of them. Meaning:
Vector3 p = TrackSpline.ControlPointsList.Last().transform.Position;
- In the following
mDir = Vector3.Lerp(mDir, targetDirection, 0.5f);
Use Vector3.SLerp instead of Lerp. Look for them online to understand why.
- About this line:
Vector3 position = TrackSpline.transform.localToWorldMatrix.MultiplyPoint3x4(p + (mDir * CPStepSize));
once again, it mixes positions/directions computed using a mix of local and world coordinates. Either compute everyting in local (and then convert to world) or in wold.About the conversion itself, you can use one of these instead, which are less prone to human error:- https://api.curvyeditor.com/FluffyUnderw...e_Vector3_
- https://api.curvyeditor.com/FluffyUnderw...e_Vector3_
- https://api.curvyeditor.com/FluffyUnderw...e_Vector3_
- https://api.curvyeditor.com/FluffyUnderw...e_Vector3_
- https://api.curvyeditor.com/FluffyUnderw...e_Vector3_
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.

