Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert position of a point on a spline to another spline which is connected
#1
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.
Reply
#2
Hi,

To get the connection from a Control Point use the Connection property: https://api.curvyeditor.com/610/class_fl...f219d77d78

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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
(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_fl...f219d77d78

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 ?
Reply
#4
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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
(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.
Reply
#6
otherSpline.InterpolateByDistance(otherSpline.Length - 5) should do the work
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
  Spline object on a spline path ATHellboy 10 198 02-20-2020, 05:45 AM
Last Post: ATHellboy
  Refresh spline doesn't seem to be working dazz777 6 652 01-22-2020, 12:55 AM
Last Post: _Aka_
Big Grin How to get a point in Spline that is parallel with another Spline? curvyuser007 5 252 01-20-2020, 10:18 PM
Last Post: curvyuser007
  Wheel Collider to propel along Spline Phunyun 3 629 01-18-2020, 09:40 PM
Last Post: _Aka_

Forum Jump: