Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I might have fixed a bug
#1
I was trying to generate a spline in code and then connect the end to an existing spline but it only worked when the target CP didn't already have a Connection on it.

Code:
CurvySpline newSpline = CurvySpline.Create();
Vector3[] vec = new Vector3[4];
...add a couple of Vector3s
vec[3] = targetSpline.ControlPoints[index].transform.position;

newSpline .Add(vec);
newSpline .ControlPoints[3].ConnectTo(targetSpline.ControlPoints[index])

So I had a look at the  CurvySplineSegment class and in the ConnectTo Method I might have found the root of the problem:

Code:
else if (targetCP.Connection)
           {
               con = targetCP.Connection;
               [b]con.AddControlPoints(targetCP);[/b]
               
           }

If I'm not mistaken then the bolded line tries to connect the targetCP to itself.
Changing it to:
Code:
con.AddControlPoints(this);
seems to fix it.
Reply
#2
You're right, that's indeed a bug. Thanks a lot, will be fixed in 2.0.3!
Reply
#3
Happy to help.

Is there an ETA for 2.0.3?
Reply
#4
Next week!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Keeping a fixed spline length jh092 3 16 02-21-2024, 06:25 AM
Last Post: Primrose44
  [Fixed]CurvySpline.Length can return 0 during init stage c0ffee 2 2,167 01-16-2020, 01:56 AM
Last Post: c0ffee
  Forum and documentation issues fixed _Aka_ 0 2,511 01-17-2018, 02:39 PM
Last Post: _Aka_
Question Fixed straight distance between 2 SC Trainzland 2 4,570 12-19-2015, 09:07 PM
Last Post: Trainzland

Forum Jump: