Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. 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. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    In case of a closed track, it should be possible to simplify it quite a bit, like in the following "pseudo" code example:
    Code (CSharp):
    1. SplineSample sample = spline.Project(worldPoint);
    2. Vector3 distance = worldPoint - sample.point;
    3. if (distance.magnitude < sample.size) // you might need to do sample.size*0.5 instead, I don't remember whether it represents the entire width or halfWidth of the track
    4.    Debug.Log("is inside");
    5. else
    6.    Debug.Log("is outside");
    The idea here is if the worldPoint is farther away from the closest point on the spline than the spline width, then it's not on the track. In all other cases it should be.
     
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    If have a Spline Follower that is located at the side of a spline-track. This causes the follower to move with varying meters per second. It accelerates and decelerates in curves, depending on what side of the curve the follower is.

    I want that the follower moves with a constant speed, regardless of its sidewards-position on the track. I've played with all the follower modes and motion velocity modes, nothing seems to do what I'm trying to accomplish.

    Please see the video below for a visual description of the problem.

    The follow speed is set to 10, so the text on the moving object should display something around 10 always, but it decelerates to 4 meters per second and accelerates to 14 meters per second in curves.

    How can I make the follower move with a constant speed, so it displays 10 always? I've attached the example I show in the video.
     

    Attached Files:

  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    BUG: Using the "Start Position" slider does not work properly when having selected more than one object, please see the video below.
    Using the "Start Position" slider should move all selected objects.
     

    Attached Files:

  4. Valto131

    Valto131

    Joined:
    Dec 12, 2016
    Posts:
    3
    Hello! I wanted to ask for some help on setting up an object to follow a spline that can be moved with physics by a player.

    In short we want a "minecart puzzle", where the player can push the cart along the spline to different locations. I've tried to achieve this using the Spline Projector component on the cart. This seemed to work just fine in the beginning, but I encountered two problems: 1) When using a higher mass and drag on the cart's rigidbody, it is very clear that the cart pushes forward or backwards to get to the splinepoints, and does not want to stay in between. This could be fine I guess, if not for 2) It's very hard to make the cart move along the spline downhill, it constantly punches back up, and if the player stops pushing, the cart quickly goes all the way up again before it stops on the top.

    Maybe this approach is not the right one at all. So I wanted to reach out and hear from you what you would consider to be the best way to achieve a "pushable" cart along a spline (if there is a way)?

    Thanks for your help!
     
  5. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    This is most likely due to the offset you have set in the motion panel. The follower does not account for that. It only calculates the length between the spline samples.
    It is probably a good idea to add a feature to calculate spline distances with added offset.
     
  6. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    What Velocity Mode are you using for your Projector?
     
  7. mutp

    mutp

    Joined:
    Oct 1, 2018
    Posts:
    45
    Hi Dreamteck,

    In my Spline Mesh component, I've added 2 channels with 2 different meshes. After I've added the 2 channels, and when I click the respective Gameobject, the editor hangs and the RAM consumption goes up rapidly. I'm forced to end task and reopen Unity when this happens. How do I solve this?

    Also, after adding the second channel, I'm unable to apply different materials to each channel. Only the material in Element 0 works, not the one in Element 1.

    EDIT: Both problems are solved. Please ignore.
     
    Last edited: Apr 15, 2020
  8. Valto131

    Valto131

    Joined:
    Dec 12, 2016
    Posts:
    3
    I've tried all 4 Velocity Mode options, but the result is the same regardless...
     
  9. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    BUG: Editing a Spline that has more than a few control points is unusable slow, taking 2-3 seconds for the spline system to register a point moved. Please note that this applies to the SplineComputer with no further generators in the scene.

    Here is a video that shows how slow moving a spline point is:

    The profiler unfortunately doesn't really give a clue, it just displays "ApplicationTickTimer" costs 2 seconds. 2s without deep profile, 3 seconds with deep profile. Deep profile doesn't reveal more information unfortunately. If I have to guess, I'd say it could be related to the 60000 memory allocations that happen in that frame.

    upload_2020-4-17_8-56-2.png

    The attached "Slow Spline Editing.zip" contains the scene file that I use in the video.

    Reproduce
    • Open "Slow Spline Editing.zip" scene in Unity 2018.4
    • Select "Spline - Orange" game object in Hierarchy
    • Select any spline point and move it around
    • Notice how slow it is
    Expected
    Spline editing should not be unusable slow. Seeing a few ms delay when moving a point would be fine, but 2 seconds doesn't work.
     

    Attached Files:

  10. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    I'm trying to reproduce your scenario but I'm not yet able to. What mass have you assigned to your mine cart and what is the drag? I've been trying different values using Align Realistic velocity mode but all seems to behave well on my side.
    Also, how are you pushing the minecart? I suppose another rigidbody with AddForce?
     
  11. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    This isn't a bug. The uniform sampling mode is heavy in terms of performance especially on bigger splines (30+ points with sample rate 10 and above). Switching to Default sampling mode will make the spline responsive.
     
  12. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    60
    Hey @Dreamteck, I've found a way to reproduce the bug which causes the positions of the control points to change by themselves (in small increments). It appears that what causes the bug is having a non-default rotation on the splined object. I've uploaded a prefab which always causes this bug to occur, even on a new unity project (although I have only tested on 2018.4.13f1). Make sure that you are in edit mode to trigger the bug.
     

    Attached Files:

    Last edited: Apr 24, 2020
  13. Valto131

    Valto131

    Joined:
    Dec 12, 2016
    Posts:
    3
    I've tried different masses and drag values also, and yes I'm using another rigidbody with AddForce to push the cart.
    But it's good to know that it works on your end, if you're not seeing a problem at your end I must've done something wrong. I'll go back and try it out some more to see if I can make it work as well! :)

    Thanks!

    Edit: I found out the problem. I had an offset on the position and rotation of the mine-cart in the Spline Projector component (in Tracing --> Motion). After removing the offset it works as it should!
     
    Last edited: Apr 18, 2020
  14. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    26
    Hi! Found problem that's make changing settings of spline on existing project is very and very difficult.
    Changing spline from Uniform to Default (or optimized) Broke logic of all position-based components, and also Clip Ranges. Here what i'm talking about:

    Untitled.png

    That thing makes all already configurated levels broken after changing spline settings. Clip range mean Distance, and anyway you calculating distance between points and I think its possible to hold distance but without uniform samples. Or i'm not right? I need to optimize Spline, but we already have 120 levels and 30 more comes, but i just cant do this...

    Here is sample of changes that happens. Levels completely different..
    upload_2020-4-20_12-12-34.png
     
    Last edited: Apr 20, 2020
  15. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    26
    And also. please do something with Spline Size. We going to mobile, but 1 spline and its components have size 1/10 of entire game! Here Size comparsion:
    upload_2020-4-20_12-1-10.png
    And its just for 2 levels - imagine what we got with our 120 levels... Build size increases massivle.. more than 100 times! You can save spline info only in SplineComputer and let other components just look to it without storing modified data by self. And also add some Strips for components that we dont uses - like colors of points. and its Sizes. Because its increases data massive too (especially point Color with 4 float values per point)/ And also please prevent mesh data saving of TubeGenerators and etc if component is generates in runtime. Because its just useless - i store meshData in scene -> scene size increased a LOT, but when game runs i just generates new mesh because of runtime updates (my tubes are moving)... even if not moves - i easily can generate new Tube on Awake or Start.
     
    Rezonanz and Peter77 like this.
  16. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    The
    subscribers
    list of a SplineComputer changes order of its elements randomly, causing noise in version control, as shown in the images below.

    Without changing anything spline related, subscribers sometimes change from one commit to the other:

    Commit A:
    dreamteck_splines_versioncontrol_noise.png

    Commit B: dreamteck_splines_versioncontrol_noise_2.png

    I've observed this for a while now and it's annoying, because it causes changes in version control, when you actually didn't change anything.

    In the example above, it's a
    SplineFollower
    and
    PathGeneration
    Component that subscribe to the
    SplineComputer
    seemingly in random order.

    Is serializing the
    subscribers
    list needed at all? It seems a
    SplineUser
    subscribes to a spline in OnEnable and when assigning a spline, making serializing the subscribers list perhaps redundant?
     
    Last edited: Apr 21, 2020
  17. unity_Jo6zuYKWQcetFQ

    unity_Jo6zuYKWQcetFQ

    Joined:
    Dec 29, 2017
    Posts:
    2
    hi,
    I have spline follower object parent of player and camera,
    the question is how I can rotate the spline follower(motion rotation) without rotating the camera.
     
  18. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    Version 2.02 has been released. Issues found by @Peter77 and our Discord community have been fixed!

    FIX: Fixed editor freeze when selecting splines in projects with an extensive folder amount
    FIX: Set the default Append mode for the point creation tool to "Ending" so that splines are not created reversed by default FIX: Prevented disabled SplineUsers from updating upon being selected/deselected in the editor
    FIX: Fixed undo / redo for Nodes
    FIX: Multiple Nodes can now be edited at once
    FIX: Fixed inaccuracy in the Length Calculator component when clip range is different than [0-1]
    FIX: Fixed scaling tool behavior when using the scale handle, releasing the mouse and using again
    FIX: Fixed the skipping issue in the Train example scene
    FIX: Fixed value editing when multiple Spline Followers are selected in the editor
    FIX: Fixed setting of the Side UV offset and scale values of Surface Generator in the Inspector window
    FIX: Fixed Object Bender behavior when the spline along which the bending is done is attached to the root object of the Object Bender
    FIX: Fixed reverted spline point positions when selecting Node Objectes which have been created using the "Create Node" option in the create point tool
    FIX: When in point creation mode, holding alt and left-clicking no longer creates spline points

    FEATURE: Pressing escape while using a spline editing tool will toggle the tool off. Pressing escape with an untoggled tool will toggle edit mode off
    FEATURE: Added a feature to preserve the follow speed of a follower if there is an offset defined in the Motion panel

    API: Refactored the SampleCollection class and took out the clipFrom - clipTo properties for stability reasons. clipFrom and clipTo are now only properties of SplineUser
    API: The SplineFollower's onBeginningReached and onEndReached now pass a double argument with the follower's percent from the previous frame.
     
    Freznosis likes this.
  19. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    497
    Dreamteck likes this.
  20. EugeneJefferson

    EugeneJefferson

    Joined:
    Sep 5, 2016
    Posts:
    8
    Hey there, working on hypercasual game. For moving Im using SplineFollower with FollowMode uniform. Here is a problem I need to track where is the player on the path(0-1), I found that I can use follower.result.percent, but it isnt uniform. How can I fix this?
    * fixed)
     
    Last edited: Apr 29, 2020
  21. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    26
    after update on 2.02 version all my spline users clip ranges resets to same value... was - 5 tubes in different positions - after update - all tubes in one position.

    Before:


    After:
     
  22. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    26
    I thins this cause problem:

    You update api but probably did not save old values?

    EDIT:
    One more important thing - my splines and some spline components (tubes) is prefabs< and i just override its values in scene.
     
    Last edited: May 4, 2020
  23. Mewtheed

    Mewtheed

    Joined:
    Sep 28, 2013
    Posts:
    1
    Hi, I'm having a bug where my splines don't follow their associated nodes correctly and tend to jitter around too. Oddly enough selecting the splines during runtime seems to fix the issue, but that's obviously not a viable solution. Can you help me with this?

    Edit : I've tried to reproduce the bug and it seems to happen only when the number of splines I have parented within the same hierarchy exceeds 2.
     
    Last edited: May 4, 2020
  24. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    26
    Hi again, new 2.02 version faild build -
    ResourceUtility accesing to editorPrefs and fix is adding
    #if UNITY_EDITOR defines for all class
    ResourceUtility
     
    Peter77 likes this.
  25. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    Deleting a Spline Point, which is not part of a NodeConnection, causes NodeConnection's to change their assigned Points.

    Please see the video below. As I delete a Point, that is not part of a NodeConnection, the actual connection changes to a different point. These Connections should stay intact when removing an unrelated point.


    I'm using version 2.02.
     

    Attached Files:

  26. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    Inserting a Spline Point "folds" the spline, please see the video below.


    I'm using version 2.02.
     

    Attached Files:

  27. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    Deleting a Point that is part of a NodeConnection, causes Dreamteck Splines to throw an Exception and breaking the Spline as well as Undo/Redo functionality.


    I'm using version 2.02.
     

    Attached Files:

  28. jh092

    jh092

    Joined:
    Sep 2, 2018
    Posts:
    21
    Hi there, I'm a recent purchaser so apologies if this question is obvious. I'm trying to find the minimum bounding rectangle of a spline path. I can find the MBR of the points but need it to also extend out to cover the spline path as well.

    Many thanks for any help

    John
     
  29. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    I would like to calculate the distance from any point on the spline to any other point on the spline along the forward direction. I need to this functionality to calculate how close a racing car is to the finish line. However, CalculateLength seems to return the shortest path always.

    Here is an awful image that shows my problem:
    upload_2020-5-18_11-11-7.png

    I want to calculate the length of the blue line, but I seem to be able to calculate the red line only.

    Here is a video that shows when I move the "racer" object, it always seems to calculate the shortest distance to the "Finish line".

    How can I calculate the length to the finish line moving along the track forwards only?
     

    Attached Files:

  30. TreseBrothers

    TreseBrothers

    Joined:
    Jan 14, 2016
    Posts:
    13
    Hello, thanks for a great tool.

    I have a question about Tube Generator. I'm using it to create big thick wires for computer equipment. The starting values for the spline/mesh are far too thick. I have found a few ways to thin down the resulting mesh, but I want to know that I am making the right adjustments.

    1) I can select all spline points and set Size to 0.1
    OR
    2) In Tube Generator > Vertices > Size to 0.1
    3) Some other way?

    * using uniform sampling, as few points as possible, single sided geometry and only 5 sides.

    Between the two options, I don't see any change in the vert count of the resulting tube mesh but the material properties for good looking tiling need to be adjusted depending on the use of 1 or 2.

    These meshes will be baked and static in the final resulting environment.

    Thanks for the advice on best practice here!
     
  31. DonCornholio

    DonCornholio

    Joined:
    Feb 27, 2017
    Posts:
    15
    Hi there !
    I have a problem with the Surface Generator . I can't edit Expand and Extrude Values, as they snap right back after editing them (i also don't see any changes in viewport when i do the edit). Same Problem with the Extrude Path property not accepting any spline computer that i provide it with.

    Anyways the Tool is really amazing, but i would have loved some more detailed explanation or video tut for the surface generator component.
     
  32. XavLasuite

    XavLasuite

    Joined:
    Sep 19, 2018
    Posts:
    5
    Hello. I've updated Dreamteck splines today and the new version broken my build. By luck I has a previous backup of the plugin to make sure I still can build my VR project. The bug is happening with the ResourceUtility.cs which is broken and also ImageDB.CS. The build was on PC, to build a VR game for SteamVR/OpenVR not Oculus. I was previously happy with the Dreamteck stuff but from this broken update and no compatibility with Forever endless engine... I'm thinking to look somewhere else.
     
  33. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    26
    Hey i have same issue and got some temp solution:

    Just add this defines for all class ResourceUtility:

    #if UNITY_EDITOR
    ...
    public class ResourceUtility....
    ...
    #endif
     
  34. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    497
    Today I've tried using the Surface Generator for the first time and I'm seeing the same issue. Expand, Extrude & Extrude Path options are not working. That's on 2019.2.21f1.
     
  35. mooumari

    mooumari

    Joined:
    May 9, 2018
    Posts:
    11
    hello there,
    i woul like to know how to make the SplineFollower move from one spline to another smoothly and how can i just strat the action of moving because when its reched the last node and i bind the spline to the next one it dose not move
     
  36. Enigma229

    Enigma229

    Joined:
    Aug 6, 2019
    Posts:
    29
    Is it possible to attach vehicles to a spline and have them play in Timeline (not Play mode)?
     
  37. thatnzguy

    thatnzguy

    Joined:
    Jun 8, 2015
    Posts:
    6
    Small bug:
    If I have a prefab with a SplineComputer in the hierarchy, and try to drag it onto a Node Connector - it does nothing.
    If I 'unpack prefab' on the prefab, it works.
    On Unity 2019.3.14f1
     
  38. resa12354

    resa12354

    Joined:
    Aug 7, 2015
    Posts:
    3
    Hi,

    Bug/Question:
    Why do sometimes point tangents and positions move by themselves when set in Local space?
     
  39. munimraza007

    munimraza007

    Joined:
    Sep 23, 2019
    Posts:
    3
    I trying to generate soft ice cream on a cone in a spiral shape. What I am having difficulty is that there is a space between mesh extrusion repetition which I am having difficulty removing. Could someone point where I am doing wrong?
     

    Attached Files:

  40. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    For everyone updating to 2.02, make sure to delete the previous installation of Dreamteck Splines before installing version 2.02.
     
  41. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    No built-in way to do that currently but a workaround would be to calculate the entire length of the spline and subtract the distance between the player and the finish line. We can add a "direction" parameter for CalculateLength in future releases.
     
  42. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    This is a known issue in 2.02 and a fix for it is coming in 2.03. You can contact our support to get the fix sooner.
     
  43. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    You would need to disable the Spline Follower and implement your own logic for lerping between two spline results, then set the follower's spline to the second one, then set the follower's percent and resume it.
     
  44. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    No Timeline support currently. We are looking into implementing it.
     
  45. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    This is a known issue that happens to a select few of our customers. We have not been able to reproduce it and would appreciate any info on your computer / unity and spline setup.

    For anyone who has encountered this issue, please drop us a line here: https://dreamteck.io/support/contact.php
     
  46. Dreamteck

    Dreamteck

    Joined:
    Feb 12, 2015
    Posts:
    276
    Your pivot is probably outside of the visible mesh bounds. Try changing the pivot to be at the center of the mesh inside your modeling application. Another reason for this happening could be isolated vertices floating in the air.
     
  47. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    4,985
    Yes, that would be helpful.
     
  48. thatnzguy

    thatnzguy

    Joined:
    Jun 8, 2015
    Posts:
    6
    The train example is great, I would love to see boogies implemented correctly, so the carriage position on the track is based on the front and back wheel position. Please consider it :)
     
  49. Asse1

    Asse1

    Joined:
    Jan 9, 2013
    Posts:
    79
    Hey guys,

    How would you create a camera following a spline where every Node doesn't only define the camera's position but also its look direction. So the camera doesn't only look forward along the Spline but the designer can adjust the look-direction for every Node.

    We tried changing the normal but I guess that's meant for something else :)
     
  50. HQF

    HQF

    Joined:
    Aug 28, 2015
    Posts:
    26
    Just disable application of rotation in spline follower and use your own looking logic
     
unityunity