Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] Curvy 2 - the ultimate spline solution

Discussion in 'Assets and Asset Store' started by Jake-L, Sep 29, 2015.

  1. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    832
    This looks very interesting. What exactly is in the asset when you buy it? I've seen the screenshots on the store page of e. g. trains and tracks. Does the asset come with that, i. e. a track generator and such for rapid prototyping or do I have to get my own assets first?
     
  2. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    When installing Curvy, you get Curvy (code and assets) plus various example scenes (and their own code and assets).
    The train, tracks, and all what you can see in the screenshots and videos are part of the example scenes included in the package you download.
    There is a webGL demo in Curvy's website if you want to test some of the example scenes.
     
    Rowlan likes this.
  3. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    832
    Nice. I already tested the webgl demo. So everything that's in that demo is included?
     
  4. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Yes, everything is included. Only the materials are slightly different between the webGL demo and the latest Curvy package, to stay compatible with the latest Unity versions (which deprecated support for Substance materials).
     
    Rowlan likes this.
  5. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Hi, I started to have a small problem, maybe from Curvy v2.3.0 (I'm using Unity 2018.2.1f1), where mesh collider cannot be added to a flat surface.

    My setup:



    Mesh Collider is not present in the resulting gameobject. Instead, on the parent (with the CreateMesh component) I noticed a yellow info that the collider couldn't be added but no reason for that.

    If I edit the shape so that it's not flat but with a slight bump, the collider gets added and all works fine. I would like to be able to add collider to a flat surface though.

    Here's the shape:

     
  6. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    You are right, the issue is triggered by the flatness of the mehs. Curvy will show a warning when it is the case, because flat meshes, when used as colliders, have issues with the Rigidbody component.
    This being said, I don't agree with the fact that Curvy should stop you from generating flat mesh colliders. I will remove this restriction in the upcoming update. Until then, you can apply the fix on your own by replacing the content of
    the canAddMeshCollider(Bounds b) method in CGMeshRessource.cs with the following:
    return true;
     
    metroidsnes likes this.
  7. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi everyone
    Curvy 3.0.0 is live. This one is a small one compared to the last update. It gets rid of all deprecated features/API, so make sure you have stopped using them before updating.
    Release notes available here https://curvyeditor.com/releasenotes.
    Have a nice day
     
  8. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Hi, I noticed recently that I cannot select spline path CP GO without getting many errors in the console. This may have start happening after I installed Unity ML-Agents, Hierarchy PRO or Project Bookmarks Hierarchy. Disabling the last two didn't help though as well as restarting Unity. It happenes on Curvy 3.0.0 and version before that, I didn't test any other.



    Null ref. exc.
    GUI error:
    I'm also getting a single
    after each recompilation.
     
  9. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi,
    I tried to reproduce the issues but couldn't. Here is some conclusions I made trying to understand what happened:
    • About the null reference: I think that it is an error on Unity's side, based on the following:
      • There is no Curvy code called in the error's callstack
      • The error callstack shows that several methods from UnityEngine.Experimental.UIElements are called. The fact that there is an "Experimental" in the namespace is not reassuring :) Plus, Curvy's editor's code does not use the experimental UIElements directly. This means that Unity is replacing parts of it's normal workflow with the experimental one, and that experimental one does not behave correctly.
      • At least one other similar issue is reported on the net, by people not using Curvy.

        So I advice you to report this bug to Unity.
    • About the error at compilation: The Curvy version is 3.0.0, right? What about the Unity version? What platform do you target? What OS do you use? Also, can you please catch the thrown exception, and log the content of it's LoaderExceptions property. If you don't know how to do that, please let me know.
      Also, please use the bug reporting tool in the future, since it adds to the report useful information, and are easier to track for me, which both make the bug fixing process more efficient.
     
  10. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Sorry, I didn't include snippets of the Curvy errors (ones from the picture), that's my bad. Errors listed below contain Curvy calls. The other ones were included to provide some context.

    Unity version: 2018.2.2f1
    Target platform: Windows
    OS: Windows 10

    About the LoaderExceptions, I'm not sure how to use it. Also I'm not sure what do you mean by using the bug reporting tools, is it the one from Unity? If there's one from Curvy, I cannot access it, Curvy UI won't display on the scene view anymore. Is there any menu option to access it?

    Tbh I don't know about the Unity experimental features, I only installed newest stable Unity build. Is Curvy supposed to work with Unity 2018.2.2f1?

    I'll do some testing on my side to find out what's causing these errors when I have some time.

    EDIT:
    Curvy: 3.0.0

    EDIT:
    This one happenes when entering play mode:

     
    Last edited: Aug 10, 2018
  11. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    In DevTools\Extensions\Extensions.cs, line 897, please replace
    Code (CSharp):
    1. return GetLoadedAssemblies().SelectMany(a => a.GetTypes()).ToArray();
    with
    Code (CSharp):
    1.  
    2.             try
    3.             {
    4.                 return GetLoadedAssemblies().SelectMany(a => a.GetTypes()).ToArray();
    5.             }
    6.             catch (ReflectionTypeLoadException exception)
    7.             {
    8.                 Debug.Log("GetLoadedTypes: Catch block");
    9.                 Debug.Log(exception.ToString());
    10.                 Debug.Log("Loader exceptions Start");
    11.                 foreach (Exception loaderException in exception.LoaderExceptions)
    12.                 {
    13.                     Debug.Log(loaderException.ToString());
    14.                 }
    15.                 Debug.Log("Loader exceptions End");
    16.                 return new Type[] { };
    17.             }
    Once you send me the logs, I will try to figure out what's wrong.

    There is one in the Curvy's UI, in the toolbar. I wasn't aware that your errors stopped the toolbar from displaying. That bug reporting tool opens this page while prefilling some fields.

    Yes it should. The release was tested using 2018.2.0f2, and I just downloaded 2018.2.2f1 and tested it, and everything seems ok.
     
  12. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
  13. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    528
    Anyone know how I can apply a different material to each segment of a volume mesh created from a spline using the generator? I tried adding a new material group thinking maybe it would give one per segment but that didn't work.


    curvy.PNG
     
    Last edited: Aug 25, 2018
  14. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    528
    Best I have figured out so far is to make a different volume mesh for each material, but the "Range" seems to be spline length based, so not sure how to make it work for each segment.
     
  15. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
    Quick suggestion, assuming I haven't missed it as an existing feature: I'd like to set extruded shape vertex colors using properties on the source spline's control points, much like material UVs currently can be.
     
  16. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    237
    I have 3 scenes, which I'll call A, B, and C. They all use Curvy splines. Starting from A and going to B and then C via level portals works fine. However, starting from B and going to C produces the following error:
    Code (CSharp):
    1. [DTSingleton] Something went really wrong  - there should never be more than 1 singleton! PLEASE INFORM THE AUTHOR!
    2. UnityEngine.Debug:LogError(Object)
    3. FluffyUnderware.DevTools.DTSingleton`1:get_Instance() (at Assets/Packages/DevTools/Components/DTSingleton.cs:48)
    4. FluffyUnderware.Curvy.CurvySpline:Awake() (at Assets/Packages/Curvy/Base/CurvySpline_private.cs:262)
    Scenes A and B use splines to animate object movement. Scene C uses a generator to extrude a bridge, using one spline to define the shape to be extruded and another to define the path along with to extrude the shape. This was made using the Shape Extrusion template.

    The scene loading code looks like this:
    Code (CSharp):
    1. // Prepare scene
    2. AsyncOperation AO = SceneManager.LoadSceneAsync(connectedSceneName);
    3. AO.allowSceneActivation = false;
    4.  
    5. // Save progress and cleanup messenger listeners
    6. // [...]
    7.  
    8. // Activate scene
    9. AO.allowSceneActivation = true;
    I wouldn't be surprised if the delayed activation caused the error. But, it is strange that it only occurs when traveling from B to C without starting in A.

    Versions
    Unity 2017.4.2f2 (64bit)
    Curvy 3.0.0
     
  17. mensch-mueller

    mensch-mueller

    Joined:
    Nov 25, 2014
    Posts:
    156
    Hi,
    I purchased Curvy a while ago, and it seemed its not ready for Retina Macs!
    I looked at the Example scenes and in 04_PaintSpline the resulted painted path is way off!
    Will this be fixed?

    Cheers
    Michael

    Edit: Version 3.0.0, Unity 2017.4.3f1 OSX 10.9.5 Macbook Pro Retina 15´
     
  18. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi,

    Thanks for reporting this issue. Unfortunately I don't own a Retina Mac, so I will need your help to debug this:

    1- Can you please send me a screenshot showing what the intended path is and what the real one is.

    2- The code used in the mentioned scene to place the path's Control Points is the following:
    addCP(e.mousePosition);
    That code is in the following file: Curvy Examples\Scripts\PaintSpline.cs
    The bug comes probably either from e.mousePosition, or from addCp (which is not part of Curvy but an example script that uses Curvy's API). So first, please confirm (or refute) to me that the issue does not come from e.mousePosition's value.

    Please answer me via MP of mail, to avoid flooding this thread with unnecessary messages. I will then post here the conclusion of the investigation.
    Thanks and have a nice day
     
  19. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    The fix for the issue above will be part of the 4.0.0 update, which should be validated by Unity in the upcoming days
     
  20. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    45
    Powerful asset, but I was hoping you could provide me with some direction. I'm trying to have a rigidbody follow physics, while being restricted to a spline track. Think of a rube goldberg machine where you drop the small metal ball into a mechanism and watch gravity lead it down the path. The rigidbody ball example wasn't very useful to me because the ball is free to fall off the track.

    @Aka_ToolBuddy I can PM you my invoice number for proof of ownership
     
    Last edited: Sep 4, 2018
  21. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi,
    You can use two meshes, both generated with a Curvy Generator, one for the visuals, and one for the physics. The visual one could be an open tube (a C or U shaped one for example), while the physics one can be a closed tube. This way, you make sure that the ball will never get out of your open tube.
     
    unity_dev3194 likes this.
  22. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    45
    Great solution. If I can bother you with another question, how can I get this rigidbody to always face the direction of the spline? Your above-mentioned solution works great for moving the ball along the spline, but the ball rotates every which way. I have a camera attached to the ball and I need the bottom of the object to always be facing the spline. The front of the object needs to be facing the direction of the spline ahead.
     
  23. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    unity_dev3194 likes this.
  24. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    45
  25. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
  26. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    It's completely OK to PM me.
     
  27. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I did a fresh install of Curvy 4.0.0 with Unity 2018.2.6 and I get this in the Console:

    upload_2018-9-7_17-41-42.png
    upload_2018-9-7_17-41-54.png

    If I try to re-import again the system doesn't detect any required files so it seems it has installed correctly.
    I get those warnings on a new scene whenever I try to navigate the camera in the scene.
     
  28. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    GamerPET likes this.
  29. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    The issue's origin is that the said dll was build using a Unity project set to .Net4.x, which created a dll incompatible with .Net3.5 projects
     
  30. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    The fix was finally validate by Unity. The version 4.0.1 is now available.
     
  31. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Hi, is it normal for the MetaCGOptions script to be added automatically to spline CPs multiple times?
    In the pic. below, CP0006 has 19 MetaCGOptions added. What may be causing this?



    EDIT: I'm Using Curvy 4.0.1
     
  32. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Yes it is completely normal .... Nah, just kidding. Can you tell me:
    • What Unity version you are using.
    • Does removing the excess scripts resolve the issue or do they appear back again?
    • What are the reproduction steps. If you can't pin point that, please send me a scene with the issue
    PS: what is that unusual Hierarchy window? Is it the result of an editor extension?
     
  33. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    I'm using Unity 2018.2.8f1. I removed these scripts once but it didn't help. I don't have reproduction steps. The hierarchy window comes from extension Hierarchy PRO +Presets And Selections.
     
  34. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    I couldn't reproduce this issue with reasonable efforts. I took a look at the code, and couldn't find anything suspicious.
    If you find any additional information that might help with the debug effort, please let me know.
    Thanks for reporting this issue
     
  35. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Is it possible to update generated mesh in Play mode in editor? I can move CPs in the scene view but the mesh doesn't update. In CreateMesh component Make Static is disabled.
     
  36. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi metroidsnes
    There is an "Auto Update" option, that should be true by default, in the Curvy Generator's inspector. Is it set to true in your case?
    upload_2018-10-5_11-54-17.png
     
  37. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Here is a minimalist scene: it just contains the default Shape Extrusion template. Modifying splines at runtime does Update the mesh. Can you test this scene and confirm to me that it works for you too?
     

    Attached Files:

  38. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    It turned out I had the Make Static toggle checked which was preventing the modules update in runtime. First time I tested, I set this to false from the graph but it must have not saved this value. Second time I changed from the inspector and it worked. Thanks for the quick reply, I appreciate that.

    EDIT: CurvySpline.CheckTransform must be set to true (inspector option in the CurvySpline module).
    EDIT: Timescale cannot be set to 0.
     
    Last edited: Oct 9, 2018
  39. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    You are welcome.
    I am guessing that Make Static was not saved because it was modified while in Play mode, or some other valid reason. But if you have any reproduction case of it not being saved because of a bug, please let me know and I will investigate it.
    Have a nice day.
     
  40. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    How to add new points to existing spline without changing its shape?

    Here's example circle:



    I want to subdivide into smaller sections but preserve the circle shape:



    But the result is that the shape gets distorted:

     
  41. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi,
    The Bezier handles (you are using a Bezier spline, right?) need to be modified accordingly after the split. I add this to the todo list for the next update. I will send you the implementation when it will be done.

    PS: by next update, I mean the one after the 4.1.0, the later being right now under validation by Unity for it to be released.
     
    Last edited: Oct 9, 2018
    metroidsnes likes this.
  42. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
  43. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
  44. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    156
    Is it possible to use the Curvy generator to create a number of additional spines that follow the original but have each new spline be offset by a different amount using the transform nodes? I'd need to gain access to the new splines so I can make use of them. Think running track with multiple lanes
     
  45. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi,

    You can use multiple TRS (Translation, Rotation, Scale) modules, each one of them will produce a new path that has the specified operation(s) applied on it. Here is an example:
    upload_2018-10-21_14-34-14.png

    upload_2018-10-21_14-34-39.png
     
  46. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    156
    I'm hopeless at explaining what I'm after, but that is quite close. What I'd like to be able to do is replace 'create line renderers' with 'create spline object'. I'd like to end up with multiple splines that run in parallel to the source spline and then have an object per spline follow its own spline using the spline controller script. I need separate splines as I want to use the distance functions to find out how far each object has to travel to the end of it's spline based on the lane/spline it is in/on.
    I could do this is pure code by calculating the points of the other splines by iterating through the source spline and adding each point to its respective spline, but once I saw the power of the generators, I realised most of what I need to do is already present. Just don't know how to get the generators to create splines I can use with spline controller scripts.
     
  47. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    Hi,
    Sorry to deliver you the bad news, but there is no generator's module that transforms a path back to a spline.
    To get back to a spline, you will need to do what you said through the API. But I think you might be able to do what you need to do without creating new splines. The following solution is one I thought about off the top of my head, without testing:
    • About the controllers: you can use the Offset section of the controller to make the object translate outside of the spline, without creating new splines.
    • About computing the remaining distance: If you access the path using the API (the CGPath class), you can get the total length of the path. You then substract from it the current distance of the object on the path. To get that distance, use the FToDistance method, knowing that, if your paths are all parallel, the F of your object is the same on all the paths (verify this part with tests, in case I am wrong). So you can get the F by using the CurvySpline.GetNearestPointTF method.
    I hope this helps
     
  48. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    156
    Thanks for the suggestions and the help. Your idea for calculating remaining distance was exactly how I was planning to do it except I'd have one spline per lane. I don't think it would work if only using one spline (for example, the outside lane in an oval has further to travel than the inside one), however you've given me a few ideas which might be more work upfront to create my scenes but simplify and speed up run-time execution.
    Will use the offset section in the controller as you described to position the slot cars at run-time and use a lookup table with F value against distance to go for each lane/slot, calculated separately beforehand using multiple splines.
    Thanks again for the help.
     
  49. faqilah92

    faqilah92

    Joined:
    Apr 7, 2017
    Posts:
    15
    Hello,i want to asking
    how to make the wheel of train follow the track?
    any video can i watch?
     
  50. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    120
    You can see how it is done in some of the provided example scenes, the 12_train.unity for example. In short, Spline Controller scripts are attached to the wheel, and then the train body's position and rotation are computed based on the wheel positions. Simple math.

    Have a nice day