10-30-2019, 02:07 AM
(10-29-2019, 03:16 PM)_Aka_ Wrote: Hi,Thanks, solved my problem.
The correct way to add control points to a spline is by using the methods from the CurvySpline class, such as Add, InserrBefore, etc...
Is my answer clear?
Have a nice day
Code:
gameObject.AddComponent<CurvySpline>();
CurvySpline c = gameObject.GetComponent<CurvySpline>();
c.Interpolation = CurvyInterpolation.Bezier;
c.Add(new Vector3(0.0f,0.0f,0.0f));
c.Add(new Vector3(0.0f, 0.0f, 156.0f));
c.Add(new Vector3(100.0f, 0.0f, 256.0f));
c.Add(new Vector3(200.0f, 0.0f, 156.0f));
c.Add(new Vector3(100.0f, 0.0f, 56.0f));
c.Add(new Vector3(0.0f, 0.0f, 156.0f));
c.Add(new Vector3(0.0f, 0.0f, 256.0f));
c[1].AutoHandles = false;
c[1].HandleIn = new Vector3(0.014761f, 0.0f, -54.69138f);
c[1].HandleOut = new Vector3(-0.014761f, 0.0f, 54.69138f);
c[5].AutoHandles = false;
c[5].HandleIn = new Vector3(0.62f, 0.0f, -57.872f);
c[5].HandleOut = new Vector3(-0.62f, 0.0f, 57.872f);