Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Dreamteck Splines - Powerful and Flexible Spline Solution

Discussion in 'Assets and Asset Store' started by Dreamteck, May 11, 2016.

  1. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    552
    I'm considering getting this asset for a simple road system. An important aspect of this are junctions - unfortunately, the documentation a little sparse in that regard. It seems like there's a functionality for junction prefabs with connection points, could you perhaps briefly explain how that is supposed to work? And I'm assuming I would need to write a small editor extension myself to determine which intersection asset to use, depending on number of splines, angles etc. Can that information be obtained relatively easily from your API? I see the documentation referencing a SplineTracer class, but that does not appear to be covered in the .PDF API reference.

    Also, how much memory allocation would be expected for sampling a spline once?

    And lastly, out of curiosity: Are there any plans to use DOTS for improving performance some time in the future?
     
    Last edited: Jul 23, 2020
    LudiKha likes this.
  2. Minimo-Studio

    Minimo-Studio

    Joined:
    Feb 18, 2015
    Posts:
    14
    Hi,

    Having read HQF's comment, I take a look and found that the scenes that contains spline in it has a significant increase in size
    SplineSize.png
    The first scene contains a 700kb prefab, I think the 10kb is only the size of a reference link to the prefab asset and scene settings.
    The other scene contains Spline has a reference to a 200kb prefab object and should be 10kb as well, but it shows 6.1MB instead. Does it affect significantly to the size of the release build?


    Another question,
    Screen Shot 2020-07-27 at 16.10.50.png
    I made levels with modular prefab meshes without any terrain. I came into this issue when I try to snap the road to sloping ground. I tried various settings but nothing give me the result. Usually I use B Spline or Bezier, as it gives nice smooth rounded meshes, but it averaging themself in slopes causing it didn't snapped correctly to the ground at elevation change. So I tried the linear mode, but it also has some twist in a node normal. And in certain angles, some of road width looked squeezed badly and don't have consistent width. The UV is also not proportionally sized in Default Sample mode, the Uniform and Optimized solve it, but it generates different mesh shape and often times is way too off from its node position.

    Screen Shot 2020-07-27 at 16.59.37.png
    This image is using the Linear and Uniform sample mode.

    Another issue is, I experience a very laggy editor while selecting objects containing Spline Mesh. It solved when I disable the Spline Mesh component. Any suggestion to solve these issues?
     
  3. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    27
    Yes it does.. that's why I wrote this. I hope dreamteck will fix it.
     
    Minimo-Studio likes this.
  4. FutureSystems

    FutureSystems

    Joined:
    Aug 21, 2019
    Posts:
    19
    Hi I am getting IndexOutOfRangeException Error. error splines.JPG Could you please help me to resolve it?
     
  5. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    Hello All
    Im trying to generate a spline at runtime and cannot work out how add points to the spline via script. Is this possible? any help would be much appreciated
    Cheers
     
  6. Denis1122

    Denis1122

    Joined:
    Jan 6, 2020
    Posts:
    4
    Hi all!
    How can i find intersection of two splines?
    Now i iterate on first, and find projections on second spline. Minimal projection is closest point to intersection.
    Is DreamteckSplines have a easiest way for find spline crossings?
     
    one_one likes this.
  7. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    552
    I don't think there is, unless you add a junction at the intersection.
     
  8. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    406

    I often end up with splines twisting, especially when using the snap to grid. Is there any way to prevent this?
     
  9. Denis1122

    Denis1122

    Joined:
    Jan 6, 2020
    Posts:
    4
    How remove all points at runtime (script) from SplineComputer?
     
    Last edited: Aug 18, 2020
  10. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    283
    Hi Guys, version 2.03 is live on the Asset Store!
    We focused on fixing issues for this one rather than introducing new features.
    Here is the list of things:

    We are still figuring out why scenes have such a big file size for some of you. Any feedback on how we can reproduce that from scratch in an empty scene would be greatly appreciated (use our support form: https://dreamteck.io/support/contact.php).

    To answer latest inquiries:

    @x_ming_x yes, this is possible, check out the examples coming with the project and our manual: https://dreamteck.io/page/dreamteck_splines/user_manual.pdf

    @Denis1122 This unfortunately isn't a trivial task and in 3D is much more complex than in 2D. We don't have a built-in way to do such thing but if you're using 2D, you can go through the splines sample by sample and check for intersection between any two samples of the two splines. To remove all points: spline.SetPoints(new SplinePoint[0]);

    @dock This is an issue with the spline normals. You can fix this by selecting the points, going to the normal tool, expanding the normal operations dropdown and selecting "Perpendicular To Spline"
     
  11. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,118
    I'm currently evaluating Rider and its analyzer points to some inefficiencies in
    SampleCollection
    , for example:

    upload_2020-8-27_9-3-44.png

    Rider says it's more efficient when changed to:
    upload_2020-8-27_9-4-3.png

    Might be worth to change all those occurrences, as it should half vector multiplications, which could be a nice improvement in all those
    while
    loops.
     
    Dreamteck likes this.
  12. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    283
    Good point! Will make sure to change this in 2.04.
     
    Peter77 likes this.
  13. Freznosis

    Freznosis

    Joined:
    Jul 16, 2014
    Posts:
    274
    Is there any way to get meshes to be evenly placed along a spline? I know I could just write my own script to do this but I am wondering if Spline Mesh is capable of this?

    Unity_2020-08-29_22-11-19.png

    The left is Dreamteck Splines with just using "Auto Count", the right is an alternate spline solution.

    I need to be able to adjust the clip range of the sleepers (wood below rail) so I can't include it in the main mesh. Even if I could, the main mesh has this same problem of being very dense in curves.
     
  14. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    283
    If you set the spline's sample mode to Uniform, then they will be uniformly placed along the spline.
     
    Freznosis likes this.
  15. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    Hello dreamteck, i try to build for windows universal platform, but i got theses error Assets\Dreamteck\Splines\Core\SplineThreading.cs(21,28): error CS0103: The name 'threads' does not exist in the current context
    will splines would be compatible in the future?
    same goes to forever toolkit as i can t build with this asset.
    thanks
     
  16. vorp

    vorp

    Joined:
    Aug 30, 2013
    Posts:
    8
    Just bought and am enjoying Dreamteck Splines 2.3.0 but I'm running into an issue where I can't set up triggers on Spline Follower game objects. I've checked Use Triggers and set a Trigger Group but no "Add Trigger" button appears and I'm left with no idea of how to proceed.
    I can create triggers on my Spline Computer component but that's not what I'm after as I want each follower to respond to reaching the end of the spline.
    The instructions in the manual seem clear enough I'm just not seeing any way to add triggers on the Spline Follower.
    I've attached an image of what I see in the interface in Unity 2020.1.2f1 on Mac.
    Please advise. Thanks.
     

    Attached Files:

  17. harringtonsp

    harringtonsp

    Joined:
    Apr 2, 2017
    Posts:
    5
    Hi Dreamteck, I'm trying to use Nodes as Junctions for a grid of spline computers. I'm trying to add a custom OnJunction event per the Train Examples, but my custom event isn't firing. I'm subscribing with _tracer.onNode += OnJunction;

    The only thing I can think is that my Node is connecting the first point of a spline to the last point of another spline, so when the Follower reaches the node, it may not "pass by" the node as the documents say. Am I correct?
     
  18. harringtonsp

    harringtonsp

    Joined:
    Apr 2, 2017
    Posts:
    5
    @vorp Instead of triggers, try creating a Monobehavior then adding a method to the delegate onBeginningReached and onEndReached

    Code (CSharp):
    1.   private SplineFollower _follower = null;
    2.     void Start ()
    3.     {
    4.         _follower = GetComponent<SplineFollower> ();
    5.         _follower.onBeginningReached += onBeginningReached;
    6.         _follower.onEndReached += onEndReached;
    7.     }
    8.     void onBeginningReached (double percent)
    9.     {
    10.         Debug.Log (transform.position);
    11.     }
    12.     void onEndReached (double percent)
    13.     {
    14.         Debug.Log (transform.position);
    15.     }
     
  19. ScottJak

    ScottJak

    Joined:
    Jul 23, 2020
    Posts:
    1
    Hello,

    I get an index out of range exception in SplineMesh.cs (I believe because I have a spline with more than 1 channel) and need to add the following at ~ line 127: combineMeshes.AddRange(new TS_Mesh[channels.count - 1]);

    Not sure if I'm doing something wrong elsewhere that's causing this issue, but just thought I'd share.
     
  20. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,118
    How can I avoid that the mesh generated by the "Path Generator" Component has these overlaps?

    upload_2020-9-9_10-33-41.png
     
    one_one likes this.
  21. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,118
    I'm trying to generate a border on each side of my main path. However, since I have to specify the Offset using world-units, I don't seem to be able to generate the border appropriately along the wider main path.

    How can I generate a border at each side that respects the main path width?

    upload_2020-9-9_11-51-35.png
     
    one_one likes this.
  22. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    86
    Hello there
    Im trying to create a endless racer game for android
    Im playing with this asset for almost 4 days now and its great
    I have a question and i hope i will get helpfull answers.
    Alright let me explain it instead of asking like a question
    I want to add a functionallity to follower component which will allow me to move player (gameobject which the follower component attached to) to left and right smoothely along the spline,but with a limit which is the length of the road we created on the spline (scale of the road from left to right)
    Any helps are appreciated
     
  23. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    27
    so many ways, here is two:
    1) Move parent transform with spline follover and move child transform with your object in local/world position relative to parent pos.
    2) change offset in spline follower
     
    Pourya-MDP likes this.
  24. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    86
    I chose second method but it seems complicated because ita just working for one side for example only right or left
    Should i create 2 offset??
     
  25. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    406
    That's excellent, thanks for the reply!!
    Dreamteck Splines is really fantastic btw, thanks for making it and providing such good support.
     
    Dreamteck likes this.
  26. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    283
    Unfortunately there is no way to avoid geometry being intersected at sharp turns. You need to either open up the turn or make the path narrower at that point.

    The offset is also not multiplied by the size of the path. We can add a checkbox to toggle this on and off.
     
  27. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,118
    That would be quite useful.
     
  28. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    406
    Any idea what's happening with my Spline Computer when I select Spline Primitives?
    Code (CSharp):
    1. NotSupportedException: The invoked member is not supported in a dynamic module.
    2. System.Reflection.Emit.AssemblyBuilder.GetExportedTypes () (at <fb001e01371b4adca20013e0ac763896>:0)
    3. Dreamteck.FindDerivedClasses.GetAllDerivedClasses (System.Type aBaseClass, System.String[] aExcludeAssemblies) (at Assets/ThirdParty/Dreamteck/Utilities/Editor/FindDerivedClasses.cs:38)
    4. Dreamteck.FindDerivedClasses.GetAllDerivedClasses (System.Type aBaseClass) (at Assets/ThirdParty/Dreamteck/Utilities/Editor/FindDerivedClasses.cs:48)
    5. Dreamteck.Splines.Editor.PrimitivesModule.LoadPrimitives () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/DS Editor/PrimitivesModule.cs:197)
    6. Dreamteck.Splines.Editor.PrimitivesModule.Select () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/DS Editor/PrimitivesModule.cs:69)
    7. Dreamteck.Splines.Editor.SplineEditor.ToggleModule (System.Int32 index) (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/SplineEditor.cs:363)
    8. Dreamteck.Splines.Editor.SplineEditor.DrawToolMenu () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/SplineEditor.cs:224)
    9. Dreamteck.Splines.Editor.SplineEditor.DrawInspector () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/SplineEditor.cs:195)
    10. Dreamteck.Splines.Editor.DreamteckSplinesEditor.DrawInspector () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/DS Editor/DreamteckSplinesEditor.cs:133)
    11. Dreamteck.Splines.Editor.SplineComputerEditor.OnInspectorGUI () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineComputerEditor.cs:185)
    12. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <fd8fd784002f49beab0500d3a24213b9>:0)
    13. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    14.  
    15.  
    16. NullReferenceException: Object reference not set to an instance of an object
    17. UnityEditor.EditorGUIUtility.TempContent (System.String[] texts) (at <fd8fd784002f49beab0500d3a24213b9>:0)
    18. UnityEditor.EditorGUI.Popup (UnityEngine.Rect position, System.Int32 selectedIndex, System.String[] displayedOptions, UnityEngine.GUIStyle style) (at <fd8fd784002f49beab0500d3a24213b9>:0)
    19. UnityEditor.EditorGUILayout.Popup (System.Int32 selectedIndex, System.String[] displayedOptions, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at <fd8fd784002f49beab0500d3a24213b9>:0)
    20. UnityEditor.EditorGUILayout.Popup (System.Int32 selectedIndex, System.String[] displayedOptions, UnityEngine.GUILayoutOption[] options) (at <fd8fd784002f49beab0500d3a24213b9>:0)
    21. Dreamteck.Splines.Editor.PrimitivesModule.PrimitivesGUI () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/DS Editor/PrimitivesModule.cs:119)
    22. Dreamteck.Splines.Editor.PrimitivesModule.DrawInspector () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/DS Editor/PrimitivesModule.cs:104)
    23. Dreamteck.Splines.Editor.SplineEditor.DrawInspector () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/SplineEditor.cs:198)
    24. Dreamteck.Splines.Editor.DreamteckSplinesEditor.DrawInspector () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineEditor/DS Editor/DreamteckSplinesEditor.cs:133)
    25. Dreamteck.Splines.Editor.SplineComputerEditor.OnInspectorGUI () (at Assets/ThirdParty/Dreamteck/Splines/Editor/SplineComputerEditor.cs:185)
    26. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <fd8fd784002f49beab0500d3a24213b9>:0)
    27. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    28.  
    29.  
    upload_2020-9-15_15-11-54.png
     
  29. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    98
    hi

    is it possible to move a train following a path it with timeline ? or to generate a path using cinemachinepath ?

    for cut scene

    redit :
    found it ! it's spline positioner !!! perfect !!!
     
    Last edited: Sep 16, 2020
  30. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    86
    Hello there i tried to create a junction and connect two splines every thing is good except that the player wont switch to other spline as it passes the node
    I did exactly what you told in docs but no luck
    The debug.log will be trigged but no change on player path and player will stop there (on nodes position)

    20200916_134059.jpg

    Heres the secen i created

    Edit:after 9 hours of struggling i found out that we should select the loop mode on the splines follower wrap mode
    Please note it on new docs
    Thanks in advance
     

    Attached Files:

    Last edited: Sep 16, 2020
  31. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,118
    All spline-point handles that I used to manipulate points disappeared.

    When I switch to edit mode, I normally see all the points that I can select and move around to modify the spline. However, these are gone now. This affects all splines in the project. Additionally, I also don't see the spline visualization anymore unless I select "Always draw spline".

    What could cause this problem?



    The gizmos are all enabled:
    upload_2020-9-17_9-1-39.png
     
    Last edited: Sep 17, 2020
  32. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    283
    Try resetting the editor layout. This is sometimes known to help but I'm not sure what it is caused by exactly in the first place.
     
  33. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    283
    We are issuing a fix for this soon!
     
unityunity