Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating connection from code
#1
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:

[Image: q6sh8nf.png]

If that is so, then how am i supposed to connect spline1 to spline2?
Reply
#2
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.
Reply
#3
(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!
Reply
#4
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.
Reply
#5
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 ?
Reply
#6
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_fl...pline.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.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Change Shape Extrusion of Generator by code UsernameHed 5 534 09-20-2019, 03:14 PM
Last Post: _Aka_
  smooth connection of two splines. Lukango 6 1,112 09-16-2019, 01:35 PM
Last Post: _Aka_
  Creating a ring of rectangles, then create series of rings to create a cylinder mchangxe 2 138 09-07-2019, 10:17 AM
Last Post: _Aka_
  I added connection to my cp. but i can not add follow-up lololToday 1 278 07-10-2019, 10:18 AM
Last Post: _Aka_

Forum Jump: