Search Unity

Corgi Splines - Extremely fast and easy spline editor and jobified spline access.

Discussion in 'Assets and Asset Store' started by funkyCoty, Jul 26, 2020.

  1. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    727
    Hmm outside of the scripts provided, not really. Is there anything in particular that you think the documentation could clarify to make learning the API simpler? For now, you could glance over the scripts included (for example, the editor scripts or the procedural meshing scripts - as well as the car follow example scripts)
     
  2. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    727
     
  3. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    727
    Another small update:

     
    Klausology and iddqd like this.
  4. nakoustix

    nakoustix

    Joined:
    Apr 21, 2019
    Posts:
    15
    Hi funkyCoty,

    thanks for the package! I decided to give it a try a few days ago and I like it. It's very performant - perfect for my procedural generation :)
    My question may be silly and I don't await a perfect solution out of the box, but since you seem to understand a lot about the subject I decided to ask.
    I'm generating a random path and have a few test criteria for it. Like
    a) the spline (planar) mustn't intersect.
    b) the closest projected points must have at least a gap of X.

    Right now I'm using a control grid (in form of a R-channel texture), marking regions "dirty" and testing for it when generating further.

    When you hear intersection test of planar spline, does a simpler method come to your mind?

    have a nice weekend
     
  5. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    727
    Do you mean you want to test if the spline is intersecting itself? Sorry I'm not fully understanding the question, haha.
     
  6. nakoustix

    nakoustix

    Joined:
    Apr 21, 2019
    Posts:
    15
    Yes exactly, that's my intention :D
    But because it's also important to have control over how close together spline segments can come, a control grid is so far the best my mind came up with ^^
     
  7. nakoustix

    nakoustix

    Joined:
    Apr 21, 2019
    Posts:
    15
    Hey funkyCoty, it's me again.. ^^

    How would I sample just one segment (in terms of "controlpoint to controlpoint") of the spline?
    Or even X segments, but specified by controlpoint start index and end index?
    Say, I wanna consider the spline as a whole (regardless of interpolation mode) but in a job only sample points from index 3 to index 4 for example..

    In the jobbified examples I see that I always have to update the whole DistanceCache
    Code (CSharp):
    1.  
    2.             var distance = ControlSpline.UpdateDistanceProjectionsData();
    3.             ControlSpline.UpdateNative();
    ...and then in the job I also have to work on the whole spline:
    Code (CSharp):
    1.  
    2.     public struct SampleSplinePartJobParallel : IJobParallelFor
    3.     {
    4.         // Output
    5.         [WriteOnly]
    6.         public NativeArray<SplinePoint> sampledPoints;
    7.  
    8.         public float sampleDistance;
    9.  
    10.         // Spline data
    11.         [ReadOnly] public NativeArray<SplinePoint> Points;
    12.         [ReadOnly] public NativeArray<float> DistanceCache;
    13.         [ReadOnly] public float DistanceCacheLength;
    14.         public SplineMode Mode;
    15.         public Space SplineSpace;
    16.         public Matrix4x4 localToWorldMatrix;
    17.         public Matrix4x4 worldToLocalMatrix;
    18.         public bool ClosedSpline;
    19.  
    20.         public void Execute(int index)
    21.         {
    22.             //TODO: From to Distance and when not true, just do nothing, maybe??
    23.            
    24.             float d = sampleDistance * index;
    25.             var t = Spline.JobSafe_ProjectDistance(DistanceCache, d);
    26.             var projectedPoint = Spline.JobSafe_GetPoint(Points, Mode, SplineSpace, localToWorldMatrix, ClosedSpline, t);
    27.             sampledPoints[index] = projectedPoint;
    28.         }
    29.     }
    Is there a way I can specify a start index and end index of the NativeArray<SplinePoint> I am caching and sampling?

    kind regards
    Michael