11-04-2015, 02:49 PM
(This post was last modified: 11-04-2015, 02:50 PM by MayhemMike.)
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.
So I had a look at the CurvySplineSegment class and in the ConnectTo Method I might have found the root of the problem:
If I'm not mistaken then the bolded line tries to connect the targetCP to itself.
Changing it to:
seems to fix 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);