Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem adding control point after another control point via script
#1
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:



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.

 
Reply


Messages In This Thread
Problem adding control point after another control point via script - by Jellybit - 02-10-2014, 01:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Control of an object that uses a spline ricke 5 363 09-16-2021, 10:30 AM
Last Post: _Aka_
  Split existing segment(s) with additional control points KStress71 1 159 09-09-2021, 05:46 PM
Last Post: _Aka_
  Accessing generator's input spline in script, changing it at runtime smackledorf 3 620 06-17-2021, 01:59 PM
Last Post: _Aka_
  Questions about Generator: mesh/objects within spline, snap to control point dartboard 5 960 06-09-2021, 12:42 PM
Last Post: _Aka_

Forum Jump: