I am trying to use Curvy as a way-point system.

I need to make a path between my object and a target point. I dynamically create a new CurvySpline with those two points transforms. Is there a way to pass initial object rotation to make it a curved route , not a straight line without too much calculations?

public SplineWalkerDistance _splineWalker;

_splineWalker.Spline = CreateSpline();

CurvySpline CreateSpline()

{

if ( Vector3.SqrMagnitude( _target.position - transform.position ) < 1f)

return null;

CurvySpline spline = CurvySpline.Create();

spline.SetControlPointRotation = true;

spline.Closed = false;

spline.InitialUpVector = CurvyInitialUpDefinition.ControlPoint;

spline.AutoEndTangents = true;

spline.Granularity = 10;

spline.AutoRefresh = true;

spline.AutoRefreshLength = true;

spline.AutoRefreshOrientation = true;

spline.ShowApproximation = true;

Vector3[] vec = new Vector3[2];

vec[0] = transform.position;

vec[1] = _target.position;

spline.Add(vec);

return spline;

}

I need to make a path between my object and a target point. I dynamically create a new CurvySpline with those two points transforms. Is there a way to pass initial object rotation to make it a curved route , not a straight line without too much calculations?

public SplineWalkerDistance _splineWalker;

_splineWalker.Spline = CreateSpline();

CurvySpline CreateSpline()

{

if ( Vector3.SqrMagnitude( _target.position - transform.position ) < 1f)

return null;

CurvySpline spline = CurvySpline.Create();

spline.SetControlPointRotation = true;

spline.Closed = false;

spline.InitialUpVector = CurvyInitialUpDefinition.ControlPoint;

spline.AutoEndTangents = true;

spline.Granularity = 10;

spline.AutoRefresh = true;

spline.AutoRefreshLength = true;

spline.AutoRefreshOrientation = true;

spline.ShowApproximation = true;

Vector3[] vec = new Vector3[2];

vec[0] = transform.position;

vec[1] = _target.position;

spline.Add(vec);

return spline;

}