Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make connection between 2 control points
#1
Hi,  
 So If I've already got a spline with say 3 control points, then I want to connect a 2nd spline to the first but between the 2nd and 3rd control point ( CP0001 & CP0002 ) 
how could I do that please.

Regards
Reply
#2
Hi,
You can connect control points only at control points. So in your case, you will have to create a control point at the desired position and then make the connection at that level.
Did this help?
Also, the Shift and Subdivide tools in the toolbar might help in your task
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
#3
Hi. I just wondered if there was a built in way if doing that.
As what i want to achieve will be at runtime what i could do is store the info of each control point then redraw the spline but adding the new connection control point at the appropriate place, ie if between cp 1 and 2 the new control point would become cp0002 then all subsequent control points would be one number higher it'd that makes sense.
Reply
#4
Hi,
The Subdivide tool is the built-in way but it will add the new CP halfway in between the existing two CPs.
The Shift tool is the built-in way to move a CP on the spline between its neighboring CPs
Other than this, you will have to use the API to do what you described
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 again, I've almost achieved what I want to achieve. Hopefully just one more question :
If I want to add a connection to say CP0003 and I've got 7 control points ( so I cant use last visible control point ) how could I do that ?

Cheers
Reply
#6
Hi,
You can access the third cp like this
yourSpline.ControlPointsList[3]
CurvyConnection is the class for creating connections
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
thanks
Reply
#8
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
#9
Sorry for even more questions but this is what I'm doing
( seg is a CurvySplineSegment)

Code:
tempExisting_spline_toJoin.ControlPointsList[4].Connection.AddControlPoints (seg);

The above control point does have a connection, when I run this it doesn't give any errors but also doesn't add the control point to the connection.

EDIT : seg is already part of another connection, could that be the reason it wont become part of the above connection ?
Reply
#10
Yes, it is because it is already in a connection. It is the same behaviour as the connect tool in the UI. I should make the method return an error message to make things clear
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
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 3 Yesterday, 07:55 PM
Last Post: _Aka_
Thumbs Up Can't delete connection lacota 3 4 03-16-2024, 11:34 AM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Does CurvySplines support displaying handles and points during runtime? niuage 1 6 12-11-2023, 12:01 PM
Last Post: _Aka_

Forum Jump: