Posts: 46
Threads: 13
Joined: Jan 2020
I have 2 splines in my game which they are connected to each other.
The Image:
https://gyazo.com/d14e4ee6223c6b41038d9894be942117
I put an object in almost start of the right spline. Also this object has 2 property which are called startPosition and endPosition. They are points which has some distance difference on spline from the object.
The problem which I have this object start position is negeative like -5 in Position but position in spline is always positive. So I want to convert this position to the position on another connected spline.
How can I achieve it ? My guess is by using GetNearestPointTF but I don't know how to get the connected spline from current spline and then Vector3 position of startPosition and convert it.
Posts: 2,113
Threads: 92
Joined: Jun 2017
Hi,
To get the connection from a Control Point use the Connection property: https://api.curvyeditor.com/610/class_fluffy_underware_1_1_curvy_1_1_curvy_spline_segment.html#ad05977a2fd568b7495c7c4f219d77d78
Use CurvySpline.InterpolateByDistance to get the position (Vector3) of a point from it's distance on the spline
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 46
Threads: 13
Joined: Jan 2020
02-16-2020, 12:39 PM
(This post was last modified: 02-16-2020, 12:47 PM by ATHellboy.)
(02-14-2020, 12:23 AM)_Aka_ Wrote: Hi,
To get the connection from a Control Point use the Connection property: https://api.curvyeditor.com/610/class_fluffy_underware_1_1_curvy_1_1_curvy_spline_segment.html#ad05977a2fd568b7495c7c4f219d77d78
Use CurvySpline.InterpolateByDistance to get the position (Vector3) of a point from it's distance on the spline
I want to find connected spline by the another one.
Is it correct to use this piece of code ?:
Code:
Spline.ControlPointsList[0].Connection.OtherControlPoints(Spline.ControlPointsList[0])[0].Spline
Also you said using CurvySpline.InterpolateByDistance to get the position of the point but what about if it is not in that spline range ?
Posts: 2,113
Threads: 92
Joined: Jun 2017
As long as the lists you are accessing have at least one element, yes that code is correct
if the value is not in the valid range, clamp it to the valid range (0;SplineLenght)
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 46
Threads: 13
Joined: Jan 2020
(02-16-2020, 08:11 PM)_Aka_ Wrote: As long as the lists you are accessing have at least one element, yes that code is correct
if the value is not in the valid range, clamp it to the valid range (0;SplineLenght)
No, I don't think so if you get what I want exactly.
I mean for example I have a object in Absolute Position of 10 then according to this position I have a point in 15 unit of Absolute Position behind this object. So this point has Absolute Position of -5. Now I want to get world position of this point and then convert it to the Absolute position of the other spline which is connected to this spline.
Posts: 2,113
Threads: 92
Joined: Jun 2017
otherSpline.InterpolateByDistance(otherSpline.Length - 5) should do the work
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.