Search Unity

Spline Power! - the lofting tool [RELEASED]

Discussion in 'Assets and Asset Store' started by MaxEden, Jun 22, 2014.

  1. th00mmas

    th00mmas

    Joined:
    Mar 4, 2015
    Posts:
    1
    Hey,

    Is there an option to export all splines together as 1 obj file at the same time?
    I got like 40 different spline's in my scene and want it to be 1 object. And I don't want to export all my splines and attach them in a 3D program and export them again.

    Thomas
     
  2. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
  3. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Hi, Thomas!
    No, there is no such option for now. It looks doable, but it's more mesh baking function, and as twobob said, there are plenty of such tools.
    Still, I could add such feature to the plan.
     
    twobob likes this.
  4. kinl

    kinl

    Joined:
    Jun 1, 2008
    Posts:
    355
    Hey

    I did send an email but I'm super desperate for a fix.

    I was running Unity 5.1.2 and Spline Power with no problems. However theres a memory leak in those earlier versions of Unity when selecting objects in the scene view when theres lots of objects (Unity issue not Spline Power), so I updated to Unity 5.3.1 which fixed the memory leak but it stopped Spline Power from working, specifically the Splineformer.cs script.

    "Assets/SplinePower/SplineFormer.cs(532,27): warning CS0219: The variable `dot' is assigned but its value is never used"

    So I kept rolling back the Unity version until I ended up back at 5.1.2 but Spline Power still doesn't work. I've deleted Spline Power folder, re downloaded and re installed to no avail.

    Any ideas?

    Thanks

    Kinl.
     
  5. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Kinl

    "Assets/SplinePower/SplineFormer.cs(532,27): warning CS0219: The variable `dot' is assigned but its value is never used"

    is a warning - not an error.

    Most likely it is is one of the underlying changes to 5.3 that has made the difference.
    Hope he gets back to you in a timely manner.
     
  6. kinl

    kinl

    Joined:
    Jun 1, 2008
    Posts:
    355
    Thanks,

    Yes it shouldn't be the culprit you're right. I think more things have gone wrong in that project than initially thought.

    Anyone else had a problem with Spline Power and 5.3?
     
  7. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Hi, kinl!
    I'll check the issue with 5.3 ASAP.
    Sorry for such bother!
     
  8. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Just checked SP on 5.3.1f
    I confirm warnings, but I can't reproduce the issue.
    Could you please describe what exactly fails to work or add some screenshots?
     
  9. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    hello. I just tried the 5.12 version and it works better than the 4.5.
    it no longer has issues with mesh filter, and its easy to just copy the spline and works with other mesh segments.

    I have a question (or feature request if possible).
    I'd like to be able to export obj as separate too, because it would be neat to use the segments as waypoints.
    roadsplinepower.jpg
     
  10. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Hi, dibdab!
    Did you mean export every segment as a separate submesh?
     
  11. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    at first I thought so, but maybe not.
    would need them as separate objects. then I'll number them and use them for waypoints.
    (I can cut them up, just would be fine to export them out like that, as an option)
     
  12. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Ok, I understood!
    I'll see what I can do, it shouldn't be hard.
     
  13. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Hi. did you ever impliment snapping / alignment to terrain?
     
  14. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Hi, wolfen231!
    No, I didn't. There is no seamless road alignment to terrain now.
    But you can snap nodes to terrain, by holding control+shift(command+shift).
    I hope this will help.
     
    wolfen231 likes this.
  15. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Do you think you can add it? I did buy this a while back, I just only recently got to using it haha.
     
    twobob likes this.
  16. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    I don't think so. Seamless snapping requires a lot of messing with geometry far beyond the original intention of this asset. For rough roads, racing tracks etc., anything with a border, just snapping nodes would look ok.
     
  17. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Yeah. I get yea. The mesh would need a lot of verts and ability to "conform" to the terrain. I can see it as a difficult task. :(
     
  18. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    True. I've seen somebody faking such alignment with shaders, but I have no knowledge of such sorcery.
     
  19. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    lol. Yeah. Even I wouldn't know how to do that one. Easy roads is probably the best solution for "roads" right now on the asset store. I just don't need something that complicated. I'd just like to take a texture, apply to a plane, have it loft across a spline and as discussed, project ONTO the terrain. I don't need intersections etc etc.

    The thing about spline assets like yours is the devs tend to vanish after time and then it becomes useless. That's happened a couple of times now. I assume its about the product just not being worth the time vs monetary return in the long run for the author.
     
    twobob likes this.
  20. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Understandable. The original intention of this asset was to give the ability to model something and then repeat it along the spline, so you can use not just some basic procedural forms, but a detailed and maybe stylized piece of model. I use it a lot in my projects for fancy walls and racing tracks and update it from time to time. People often ask me to add some features about racing AI and animation, so I'm working on waypoint system right now (And to be honest I'd found it useful too) And economically, yes it worth one ice cream cake at the end of the month :p
     
  21. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    HAHA, but ice cream cake is sooooooooo good. There was a spline tool that did what I want, but its one of those that the author vanished. So it does not work in unity 5 of course and some later versions of 4.

    But yeah, splines like yours are also fantastic for things like fences, or getting something to follow a smooth path etc. So yeah. Ill still be using this at some point. Just hoping one day I can find another one that did what the other one did.
     
    MaxEden likes this.
  22. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Hi

    I recently bought your plugin and trying to create loopings, but the track seem to get twisted when it becomes perfectly vertical. Seems like the spline orientation is being flipped here. See attached screenshot:
    upload_2016-8-12_20-29-33.png
    I tried the "rollercoaster fix", but that didn't fix it.

    Any ideas how to fix this?
     
  23. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Hi, jpienbro!
    Oh, I see, the roller coaster fix doesn't work for some cases.
    For now it should work for loops in ZY plane.
    It's a hard task to be honest, the spline itself doesn't have enough info about orientation, so the fix is a hackish way to predict where the side flip is going to be.
    So, no vertical loops for now, sorry :(
    I'll think about explicit orientation settings.
     
  24. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thank you for the response ;)

    I generate my path on runtime, so I have orientation info of each point. (I know which direction a point should be facing).

    For now I'll just disable vertical loop patterns in my pattern generator.
     
    MaxEden likes this.
  25. tmargolis

    tmargolis

    Joined:
    Aug 18, 2016
    Posts:
    1
    Hi, I purchased SplinePower today & am enjoying it quite a bit. I'm using it to dynamically generate splines at runtime. I'm able to create the new game objects with associated meshes & the right number of nodes, but i'm having a lot of difficulty trying to correctly position the nodes. Could you please provide an example of how to properly create splines with more than two nodes at runtime? Here's the code i'm currently using:
    Code (CSharp):
    1.    
    2. public void NewData(string d)
    3.     {
    4.         JSONNode JPaths = JSON.Parse(d);
    5.         for (int i = 0; i < JPaths.AsArray.Count; i++)
    6.         {
    7.             GameObject go = createSpline();
    8.             Vector3 pp = transform.position;
    9.             go.transform.position = new Vector3(pp.x, chartHeight/(float)JPaths.AsArray.Count * (float)i, pp.z);
    10.  
    11.             // Setup nodes
    12.             SplineFormer sf = go.GetComponent<SplineFormer>();
    13.             string p = JPaths[i];
    14.             string path = p.Substring(1, p.Length - 2);
    15.             string[] nodes = path.Split(',');
    16.             for(int j=0; j<nodes.Length; j++)
    17.             {
    18.                 string n = nodes[j];
    19.  
    20.                 float zPos = chartLength / nodes.Length * (float)j;
    21.  
    22.                 if (j > 1)
    23.                 {
    24.                     SplineNode sn = sf.AddNodeImmediately();
    25.                     sn.transform.position = new Vector3(sn.transform.position.x, sn.transform.position.y, zPos);
    26.                 }
    27.                 else if(j == 1)
    28.                {
    29.                     SplineNode sn = sf.Nodes[j];
    30.                     sn.transform.position = new Vector3(sn.transform.position.x, sn.transform.position.y, zPos);
    31.                 }
    32.             }
    33.             sf.InvalidateMesh();
    34.         }
    35.     }
    36.  
    37.     public GameObject createSpline()
    38.     {
    39.         // Create new GameObject to hold spline
    40.         GameObject go = new GameObject("Spline");
    41.         go.transform.SetParent(gameObject.transform, false);
    42.  
    43.         // Create a new SplineFormer
    44.         SplineFormer _splineFormer = go.AddComponent<SplineFormer>();
    45.  
    46.         // hide nodes
    47.         _splineFormer.VisualOptions.NodeSize = 0.1f;
    48.  
    49.         // associate segment mesh
    50.         _splineFormer.LoftingGroups[0].SegmentMesh = SegmentMesh;
    51.         // create & associate MeshFilter
    52.         MeshFilter _meshFilter = go.AddComponent<MeshFilter>();
    53.         _splineFormer.LoftingGroups[0].MeshFilter = _meshFilter;
    54.         // create & associate MeshCollider
    55.         MeshCollider _meshCollider = go.AddComponent<MeshCollider>();
    56.         _splineFormer.LoftingGroups[0].MeshCollider = _meshCollider;
    57.         // create MeshRenderer & Material
    58.         MeshRenderer _meshMeshRenderer = go.AddComponent<MeshRenderer>();
    59.         _meshMeshRenderer.material = _material;
    60.         return go;
    61.     }
    As you can see in the attached snapshot, the first node in each spline is as expected, but the second node is far over & the remaining nodes seem to be kinda correct, but not quite. What i expect to see is all three splines having the same length with the various nodes evenly distributed along each spline.
    upload_2016-8-18_21-20-37.png

    Thanks so much!
     
  26. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    I cant find where zPos is set for j ==0 in your script, maybe that could be the reason?

    Anyway, I made a simple script. The script shows how to add/remove/update nodes dynamically. I hope it'll help!

     

    Attached Files:

    twobob likes this.
  27. AndresSepulveda

    AndresSepulveda

    Joined:
    Mar 12, 2014
    Posts:
    52
    Hi
    i am making a racing game. I would like to spawn traffic cars at certain distance where the player is on the street.
    I can't find a way of figure out how to know what is the value of the point (o vector3) at certain distance from origin.
    so if the player is at position 100 of the spline, i would like to know where is the position of the point in the spline 20 points ahead (the spline is random generated)
     
  28. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Hi, Don-Frag!
    Sorry for late reply!
    Actually you bought the asset in a perfect time :)
    I just finished new waypoints module.
    It'll allow you to do a lot of things with the spline as if it was a path.
    It has plenty of functions for working with the position relative to the spline.
    For example it has functions like
    Code (CSharp):
    1. GetDistanceAtPoint
    2. GetPointAtDistance
    3. GetWaypointsAtDistance
    4. GetWaypointsAtPart
    You can even retrieve some racing-games specific info like
    crossing the finish line,
    moving in a wrong way

    Also there is WaypoinRider component in the new version. This component allows you to move an object along the spline.

    The package also includes fix for squeezed caps( OMG sorry, Tim!) and a lot of performance tweaks.

    If you want a sneak peek you can check following links:
    http://edentec.org/Demos/SplinePower/KartDemoAdvanced/index.html
    http://edentec.org/Demos/SplinePower/PathData/index.html
    http://edentec.org/Demos/SplinePower/StarShowcase/index.html
    http://edentec.org/Demos/SplinePower/KartDemoSpectator/index.html
    http://edentec.org/Demos/SplinePower/RailsDemo/index.html
     
    twobob and JBR-games like this.
  29. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Updating to 5.6 at any point?
     
  30. CDUnityDev

    CDUnityDev

    Joined:
    Jan 31, 2017
    Posts:
    25
    On 5.6 it was working fine, then Unity crashes and I open the project back up - and now the spine system I set up is invisible except for the nodes. How do I get everything back?
     
  31. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Hmm, have you tried to reassign mesh renderer and meshes? Does it crash every time you do some specific action?
     
  32. CDUnityDev

    CDUnityDev

    Joined:
    Jan 31, 2017
    Posts:
    25
    So far I've just been exporting the spline meshes using the OBJ exporter - reassigning the mesh renderer & meshes didn't change anything, it was still invisible. Basically any time I make a spline system, save, and close Unity... When I reopen everything is invisible except the path. Will update with further details in a bit.
     
  33. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Is this discontinued? I see the last comment in the product page is 2 years old.
     
  34. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Dunno about support. Still works though

    upload_2018-8-26_6-30-45.png
    upload_2018-8-26_6-31-43.png
    Just tested in 5.6. Dunno about higher versions
    Not deprecated
     
  35. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Mhhh I am on 2018... thanks for help.
     
  36. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    The chilling prescience is visceral

    Docs. https://web.archive.org/web/20160227042652/http://edentec.org/docs/interface/
     
    Last edited: Aug 17, 2021
  37. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I got it working in 2020. Fwiw HDRP (give or take a vertex color here and there)
    upload_2021-8-17_15-56-41.png
    Still woefully missing the terrain alignment though. Hey ho
     
    Last edited: Aug 17, 2021
    PolyMad likes this.
  38. MaxEden

    MaxEden

    Joined:
    Jun 22, 2013
    Posts:
    82
    Heh, ok :) I'll rerelease it for LTS. Should be working fine.
     
    Gekigengar and twobob like this.
  39. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hope you are okay max, know it wasn't many ice-cream sandwiches. FWIW I'm trying to smash this into MapMagic2 bro. It HAS terrain alignment (what with it actually /making/ the terrain) so maybe I can fudge something... Actually thinking about it... the "walls" and "fences" I want will largely be on "flattened" ground anyways so it should be relatively easy.

    I am gonna seriously regret saying that...
     
  40. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    (This is all done on the fly via mapMagic and external rubbish I scripted.)

    Shoved down some placeholder formers built from verts positions on the spots required (at Y==0) ; Those X Z positions were extrapolated from another external set of data and then post interpolated to the right Y to conform to the terrain.

    Seems to work ok. Thanks.

    upload_2021-8-18_2-50-54.png
     
    Last edited: Aug 18, 2021
  41. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    it seems counterintuitive to scale the sections count myself. Did I miss a setting?
    upload_2021-8-18_3-30-24.png
     
  42. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    usually just need to spawn lots of the same type of spline. like say - a fence. The same fence.

    Is there not a way to just have a "lofting group" that references the main lofting groups settings.
    I literally have to set up a thousand lofting groups to have 1000 identical fences (that are discontiguous). It would seem to make sense to just have one "Group" settings and /n/ instances of node paths... no? Am I being stupid? does it already work like this?
     
    Last edited: Aug 19, 2021