Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create splines at runtime: correct initialization
#3
(10-29-2019, 03:16 PM)_Aka_ Wrote: Hi,
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
Thanks, solved my problem.

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);
Reply


Messages In This Thread
RE: Create splines at runtime: correct initialization - by Josenildo - 10-30-2019, 02:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Unity Splines _Aka_ 5 18 Yesterday, 11:11 AM
Last Post: _Aka_
  Set Volume to the Volume Controller at Runtime pako88 2 10 04-08-2024, 03:26 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Heart Create beautiful curves ShiroeYamamoto 3 11 03-26-2024, 06:25 PM
Last Post: _Aka_

Forum Jump: