I've searched and haven't found an answer to this. So, I start out with a curve with two points (CP000 and CP001), and a mesh path. I'm trying to add to this curve to extend the mesh path in real-time. In the interface, I can add points easily, and it just tacks on to the end in the correct location and as "CP003". The problem comes in when I try to do it in script. The documentation says "Add(CurvySplineSegment insertAfter)". I give it a segment, and it makes another CP000, and puts it in the wrong location, breaking my mesh. Here are the important bits I'm setting up:
I've tried adding from spline[0] and spline[2] as well, with no luck. Just using "Add()" doesn't work either. An invalid segment does nothing, and a valid segment breaks the curve/mesh every time. Please tell me if I'm misunderstanding how this works.
Bonus Question: Is there a better way to approach allowing the user to "draw" the curve mesh path in real-time? Currently I'm moving the last point along the point of interaction, then creating a new point when I get to a certain distance, repeat. Am I doing this in a weird and glitchy way?
Any help would be greatly appreciated! Thanks in advance.
Code:
public GameObject splineObject;
private CurvySpline spline;
private int currentPoint = 1;
//in Start()
spline = splineObject.GetComponent<CurvySpline>;();
spline.Add ( spline[currentPoint] );
I've tried adding from spline[0] and spline[2] as well, with no luck. Just using "Add()" doesn't work either. An invalid segment does nothing, and a valid segment breaks the curve/mesh every time. Please tell me if I'm misunderstanding how this works.
Bonus Question: Is there a better way to approach allowing the user to "draw" the curve mesh path in real-time? Currently I'm moving the last point along the point of interaction, then creating a new point when I get to a certain distance, repeat. Am I doing this in a weird and glitchy way?
Any help would be greatly appreciated! Thanks in advance.