Posts: 2
Threads: 1
Joined: Dec 2018
12-13-2018, 01:23 AM
(This post was last modified: 12-13-2018, 01:31 AM by kardoser.)
So i am trying to connect Spline1 last point to Spline2 first point.
What i tried is
Code:
class ConnectionCreator : MonoBehaviour
{
public CurvySpline spline1;
public CurvySpline spline2;
private void Start()
{
CurvyConnection curvyConnection = CurvyConnection.Create(spline1.LastSegment, spline2.FirstSegment);
}
}
The problem is it gets the control point in n-2 which i understand it's the start of the LastSegment.
This is what i see when playing:
If that is so, then how am i supposed to connect spline1 to spline2?
Posts: 1,976
Threads: 82
Joined: Jun 2017
12-13-2018, 11:18 AM
(This post was last modified: 02-27-2019, 11:27 AM by _Aka_.)
Hi,
You should use instead CurvySpline's LastVisibleControlPoint, or directly the list of control points named ControlPointsList
In Curvy, a control point is considered a segment if it is at a segment's start. Following this logic, the last control point of an open spline is never a segment
Please consider leaving a
review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Posts: 2
Threads: 1
Joined: Dec 2018
(12-13-2018, 11:18 AM)_Aka_ Wrote: Hi,
You should use instead CurvySpline's LastVisibleControlPoint, or directly the list of control points named ControlPointsList
In Curvy, a control point is considered a segment if it is the at a segment's start. Following this logic, the last control point of an open spline is never a segment
Thanks, that was really helpful!
Posts: 1,976
Threads: 82
Joined: Jun 2017
You are welcome
Please consider leaving a
review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Posts: 44
Threads: 16
Joined: Nov 2018
Hi I'm also trying to create a connection in code, how could I get a segment that isn't the first or last in a spline ?
Posts: 1,976
Threads: 82
Joined: Jun 2017
02-27-2019, 11:29 AM
(This post was last modified: 02-27-2019, 11:30 AM by _Aka_.)
Hi,
var yourSegment = yourSpline[segmentIndex];
knowing that segmentIndex is between 0 and yourSpline.Count -1, both included
More about the CurvySpline class in the API's documentation: https://api.curvyeditor.com/520/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html
Have a nice day
Please consider leaving a
review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.