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
  Getting Distance from a World Point zorksox 3 5 04-16-2024, 07:30 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
  Adjust radius of generated mesh via script? Shackman 1 4 03-26-2024, 01:12 PM
Last Post: _Aka_
  Connections Problem Juton 3 16 03-06-2024, 10:41 AM
Last Post: _Aka_

Forum Jump: