Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spline editing questions
#1
Hi,

I was exploring possibilities of spline editing in Unity Editor and I have some questions:
1. Is it possible to split spline segment by pressing some button and then clicking on point of spline where I need it to be split? So, fast alternative to Subdivide -> Slide
2. Can I create new spline using GameObjects positions or other spline's control points as markers to put new spline's control points?
3. How do I subdivide last segment of closed spline, e.g. circle? It's pretty easy to subdivide any other segment, but when I'm trying to subdivide last segment, it subdivides all segments, except the one I need :) perhaps, it's a bug?
Reply
#2
Hi
1. That is not possible. The closest thing possible, besides Subdivide -> Slide, is to select the CP before the subdivision, then add a new CP using the spline drawing tool, and try to click as close as possible to the spline point you want
2. There is no one click solution to that. You can do that using the API, by iterating through all the GOs and adding to the spline those GOs' positions (CurvySpline.Add)
3. In that case (closed splines), there is an ambiguity regarding what segments to subdivide, or in other words, what direction to follow when going from one CP to another. For now Curvy does not allow for the user to solve the ambiguity. I have a work around that involves modifying code. It will not handle all cases, but that might suit your use case. Will send it to you via PM

For all the 3 points you raised: these are very valid remarks. I added them to the list of user requests, and will consider them when deciding what to work on next.

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
Thank you very much for your answer - it is very helpful!
I definitely will use the code you sent me :)

Could you please answer one more question - when I click the curve of spline segment, that segment gets selected (which is pretty cool feature). But I'm having hard time to find in sources how it works - how do you raycast point on screen to spline?
Reply
#4
I might be wrong (I am not the one who wrote that code in the first place), but my tests lead me to believe that the selection is handled by Unity, as long as the drawing is done in a OnDrawGizmos method using methods from the Gizmos class.

I have a unreleased API method that gets the nearest point from a ray. I haven't tested it and optimized it properly yet. I attached it to this post. This code was written some time ago, so it might not build with the latest version. If it is the case, and you can't fix the build yourself, let me know so I can help.

Did this help?


Attached Files
.cs   TestNeaerest.cs (Size: 1.33 KB / Downloads: 3)
.cs   CurvySpline_Ray.cs (Size: 3.13 KB / Downloads: 3)
.cs   CurvySplineSegment_Ray.cs (Size: 2.44 KB / Downloads: 3)
.zip   NearestRay.zip (Size: 3.78 KB / Downloads: 2)
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
(12-03-2021, 10:29 PM)_Aka_ Wrote: I might be wrong (I am not the one who wrote that code in the first place), but my tests lead me to believe that the selection is handled by Unity, as long as the drawing is done in a OnDrawGizmos method using methods from the Gizmos class.

I have a unreleased API method that gets the nearest point from a ray. I haven't tested it and optimized it properly yet. I attached it to this post. This code was written some time ago, so it might not build with the latest version. If it is the case, and you can't fix the build yourself, let me know so I can help.

Did this help?

Thanks, it is very helpful! I will try out your script at weekend
Reply
#6
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
  Scene 51 questions lukasynthetic 3 10 06-22-2022, 04:12 AM
Last Post: _Aka_
Brick Delete CurvySplineSegment from the start of a Spline causes UV's to change studentloan 5 6 06-14-2022, 03:14 PM
Last Post: _Aka_
  Obstacle Moving Along the spline Chanon 1 5 06-13-2022, 04:13 PM
Last Post: _Aka_
Information Common reasons why your spline gizmo is invisble _Aka_ 0 1 05-20-2022, 03:56 PM
Last Post: _Aka_

Forum Jump: