Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
snap to the curve created by the curvy splines segment points
#1
Hi everybody,

is there a way to get the white curve created by the spline segments? I mean if it's a straight line, I can calculate the specific location of the points on that line, but in this case I want to find the points on this curve. I want to make a function that when I bring a point too close to this white curve, that point will snap to the position of the white curve.

I'm not good at English so I use google translate. Hope everyone understands what I mean.

Thanks everyone.  Heart


Attached Files Thumbnail(s)
   
Reply
#2
Hi,

Let's call Spline A the one used for the blue band, and Spline B the one used for the gray one.

If I understand you correctly, you want to automatically extend the length of Spline A so that it snaps on Snap B, while keeping the Spline A as a circle, right?

Assuming this what you want, this feature needs two things:
  1. The automatic extension of Spline A while staying a cirlcle.
  2. The snap on Spline B.


I will start with 2:
The API method CurvySpline.GetNearestPoint allows you to find the nearest point on Spline B from the end of Spline A. You can use it to snap the control point. This method can be used via API, or by attaching to your object the script Nearest Spline Point

About point 1:
You will have to place the control points and their Bezier handles in a way that form a circle or circular arc. You can use the implementation of CSPie and CsCircle for this.

Combining points 1 and 2:
If I had to do what you want to do, I would gradually make the circular spline longer, and check if spline B is close enough, and if yes i would position the last control point of Spline A to its nearest point on Spline B.

I hope this helped.
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
(03-28-2024, 10:23 PM)_Aka_ Wrote: Hi,

Let's call Spline A the one used for the blue band, and Spline B the one used for the gray one.

If I understand you correctly, you want to automatically extend the length of Spline A so that it snaps on Snap B, while keeping the Spline A as a circle, right?

Assuming this what you want, this feature needs two things:
  1. The automatic extension of Spline A while staying a cirlcle.
  2. The snap on Spline B.


I will start with 2:
The API method CurvySpline.GetNearestPoint allows you to find the nearest point on Spline B from the end of Spline A. You can use it to snap the control point. This method can be used via API, or by attaching to your object the script Nearest Spline Point

About point 1:
You will have to place the control points and their Bezier handles in a way that form a circle or circular arc. You can use the implementation of CSPie and CsCircle for this.

Combining points 1 and 2:
If I had to do what you want to do, I would gradually make the circular spline longer, and check if spline B is close enough, and if yes i would position the last control point of Spline A to its nearest point on Spline B.

I hope this helped.
Have a nice day

I did it. Thank you.
Reply
#4
You are welcome.
If and when you feel like it, please leave a review for the asset, that helps a lot.
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
Information New free asset: Converter For Unity Splines _Aka_ 5 18 04-25-2024, 11:11 AM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 1 10 04-03-2024, 03:16 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_

Forum Jump: