Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[RELEASED] Curvy 2 - the ultimate spline solution

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

  1. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,009
    @up I had got the same problem some time ago.
    You will probably not be able to do it the easy way. (if you manage please tell me how you did this)
    I had to change some of the curvy components to take data from outside, so I can reuse/share it in multiple places. (ex: multiplier curve)
     
  2. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi

    From the screenshot, I can see that you are not using the latest Curvy version. As you can see in the screenshot bellow, I have the desired result with the latest version

    upload_2021-3-27_18-31-19.png

    I attached the scene file if needed
    Have a nice day
     
  3. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi

    From the screenshot, I can see that you are not using the latest Curvy version. As you can see in the screenshot bellow, I have the desired result with the latest version

    View attachment 823556

    I attached the scene file if needed
    Have a nice day
     

    Attached Files:

  4. mutp

    mutp

    Joined:
    Oct 1, 2018
    Posts:
    79
    I tried what you said it works for the most part
    upload_2021-3-29_16-37-31.png

    except here, where there seems to be a strange rotation
    upload_2021-3-29_16-37-51.png

    using the same setup as in the scene you sent
    upload_2021-3-29_16-38-14.png
     
  5. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Probably because of a big change in the orientation at that point. Can you try, as an experience, to set the path resolution in the Shape Extrusion module to the maximum, while disabling Optimize?
     
  6. mutp

    mutp

    Joined:
    Oct 1, 2018
    Posts:
    79
    That helped, thanks! I also tweaked the cross base value which helped as well.
     
    Aka_ToolBuddy likes this.
  7. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Humm, also, for spline controller to be relative, if I have Rectangle, I want 0.25 meaning 1/4 position along the total path distance, not each corner. I think this is a bug ? For relative mode the position has to be along the total distance of the path, not the control point?
     
  8. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi
    For spilne controllers, relative mode is equivalent to TF. Explanation here: https://curvyeditor.com/documentation/controllers/start#position
     
  9. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Ok, fair enough, but I think there should be an option to use TF for relative mode or absolute mode like 0-1. Sure, we can just use absolute mode and do the division ourselves, but... that's another user step that we have to "calculate" if we want the object to start follow at say exactly 1/4 of the total distance... Give us option so that relative mode uses distance range from 0 - 1.
     
  10. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    I agree with you. I am aiming at implementing this in a future update.
     
  11. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
  12. doukisan

    doukisan

    Joined:
    Nov 26, 2015
    Posts:
    15
    Hi! I'm searching for a spline asset which I could use to make 3D "islands" with premade tile border assets (just like your road with lights example), but for this I would need a Cap function to make the top part of this model.

    Imagine a circle made with Curvy. The edges would be the model (like the road, but to serve as the edge of the island) and the top would be a simple plane which I could assign a tiling material to match with the border's material.

    Would this be possible with Curvy? This is what I'm trying to achieve, but in 3D with splines:

     
  13. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi

    If I understand you well, and this picture resembles to what you try to achieve, then yes you can do it via Curvy Splines

    upload_2021-6-10_23-21-43.png

    I attached the scene that I created to produce the above screenshot

    Let me know if you have other question
    Have a nice day
     

    Attached Files:

  14. doukisan

    doukisan

    Joined:
    Nov 26, 2015
    Posts:
    15
    I noticed the Extrude function, but it's not quite what I'm looking for. I'd like to add a custom mech for the border and fill the center with a ngon mesh cap with a tiled material...

    The edges of the extrusion are quite sharp and straight, I'd like to make a custom mesh to simulate the rocks and use that as a base
     
  15. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Then, if I understand you correctly, you can place the rocks on the borders using the Curvy Generator. In this tutorial you can get an idea about how to do it:


    I will list bellow other features that might be helpful to make your island:
    Did this help?
    Have a nice day
     
    doukisan likes this.
  16. doukisan

    doukisan

    Joined:
    Nov 26, 2015
    Posts:
    15
    Yes, this was very helpful. Thanks!

    Just one more question, though... Would I be able to mark the generated mesh as static and bake lightmap information as any other meshes in scene?
     
  17. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Yes, all possible
     
  18. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    I bought this plugin year back. I started working with it from few weeks back. In editor its working fine. But building on windows x86_64 I am getting there following null reference exception.

    NullReferenceException
    at (wrapper managed-to-native) UnityEngine.Transform.get_localPosition_Injected(UnityEngine.Transform,UnityEngine.Vector3&)
    at UnityEngine.Transform.get_localPosition () [0x00000] in <fe6edeebaf0d4e65b1405a87cbfd344a>:0
    at FluffyUnderware.Curvy.CurvySplineSegment.get_HasUnprocessedLocalPosition () [0x00001] in ...\Assets\Thirdparty\Curvy Plugin\Curvy\Base\CurvySplineSegment.cs:691
    at FluffyUnderware.Curvy.CurvySpline.doUpdate () [0x00154] in ...\Assets\Thirdparty\Curvy Plugin\Curvy\Base\CurvySpline_private.cs:595
    at FluffyUnderware.Curvy.CurvySpline.Update () [0x00018] in ...\Assets\Thirdparty\Curvy Plugin\Curvy\Base\CurvySpline_private.cs:392

    NullReferenceException
    at (wrapper managed-to-native) UnityEngine.Component.get_gameObject(UnityEngine.Component)
    at FluffyUnderware.DevTools.ComponentPool.sendBeforePush (UnityEngine.Component item) [0x00001] in ...\Assets\Thirdparty\Curvy Plugin\DevTools\Components\ComponentPool.cs:318
    at FluffyUnderware.DevTools.ComponentPool.Push (UnityEngine.Component item) [0x00001] in ...\Assets\Thirdparty\Curvy Plugin\DevTools\Components\ComponentPool.cs:217
    at FluffyUnderware.Curvy.CurvySpline.OnDestroy () [0x00036] in ...\Assets\Thirdparty\Curvy Plugin\Curvy\Base\CurvySpline_private.cs:331

    (Filename:.../Assets/Thirdparty/Curvy Plugin/DevTools/Components/ComponentPool.cs Line: 318)

    inspector screenshot.png
     
  19. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi
    You are having a NullReferenceException inside a Unity method (Transform.get_localPosition) which is never supposed to happen. What I suggest:
    First, try to reproduce the issue in a new minimal project. Then open a Unity bug ticket, using Unity's bug reporting tool, while attaching that project. While waiting for their answer, try using another (older and newer) version of Unity, it might not have the issue. You can also send me that minimal reproduction case, I am not sure I can be of any help, but I will give it a try.
     
  20. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,866
    Indeed.
    What exact version of Unity are you on @Aldo-V ?
     
  21. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    I found the cause seams like on runtime I cant simply Destroy CurvySplineSegment gameobject like I been doing in Unity editor play mode.
     
  22. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    I am try to add CurvySplineSegment gameobject to spline instead of CurvySpline.Add(Vector3).

    Code (CSharp):
    1.  
    2.                 curvySpline.enabled = false;
    3.                 var curvySplineSegment = node.GetComponent<CurvySplineSegment>();
    4.                 curvySplineSegment.LinkToSpline(curvySpline);
    5.                 curvySpline.enabled = true;
    6.                 curvySpline.Refresh();
    I got it working only by component disable and enable. Its not updating with just Refresh. Is this right way of doing?
     
  23. artur_hartikainen

    artur_hartikainen

    Joined:
    Apr 10, 2017
    Posts:
    3
    Hello,

    I have created a small road network connected to each other using Curvy and I was wondering if I can somehow be able to get a shortest route/path information from current vehicle position to point B (located somewhere, where player desire to go)...

    Maybe someone solved this earlier?
     
  24. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,009
    How to generate UV2 for lighmapping when doing the extrusion and using VolumeMesh ? (or other method)
     
  25. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi
    You should use the Add methods or the Insert methods to add control points. They do more than just adding the object to the hierarchy (handling events for example). So modify your code to avoid using the GetComponent<CurvySplineSegment>, enabling and disabling, and see if the issue is gone.

    The game object destruction methods that you have to use in edit mode and play mode are different. You will learn more about this by reading the Unity documentation of Destroy and DestroyImmediate
     
  26. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
  27. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Curvy Splines does not include any path finder. Using the Curvy's API, you can get all the needed data about your network to input to any path finder. If you are new to this field, this page is a good start: https://en.wikipedia.org/wiki/Pathfinding
     
  28. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,009
  29. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    There is indeed an issue with UV2 generation under some circumstances. Please send me privately your invoice number, and I will send you the patch to fix that.
     
  30. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    I didn't meant difference between editor edit mode and play mode. I meant difference between editor playmode and runtime on target build. I just provided information for you that its not Unity bug as you said earlier. :)
     
  31. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Noted. So did you try the solution I suggested? Did it work?
     
  32. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    I had specific use case where I wanted to add waypoint prefab to spline. Waypoint prefab is bit complex with few scripts and meshRenderer so Inserting points using Add/Insert and adding back required components is again lots of AddComponent code. Anyway other than this use case Add/Insert works perfect. I realize I could also add waypoint prefab as child of waypoint if I encounter any performance issue, so no problem thank you for support.
     
  33. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    You are welcome. If I can be of further help please let me know. Also don't hesitate if you have any improvement suggestion.
    If and when you feel like it, please leave a review for the asset, that helps a lot.
    Have a nice day
     
    spark-man likes this.
  34. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    hi, CurvySpline.Count api returning incorrect segment count. for 2 segment returning 1 and for 1 segment returning 0. Any idea?
     
  35. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    Seams like CurvySpline.count returning returning 1 less segment count for CurvySpline.Closed = false but correct no. of segment for CurvySpline.Closed = true
     
  36. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi
    Count = number of segments
    ControlPointCount = number of control points
    If your open spline has two control points one at it start and one at its end, then there is only one segment (one line) between those two points.
     
    spark-man likes this.
  37. mutp

    mutp

    Joined:
    Oct 1, 2018
    Posts:
    79
    I'm trying to generate a mesh along a linear spline.
    upload_2021-7-19_19-45-34.png upload_2021-7-19_19-46-34.png

    However, I"m getting artifacts like above. My Shape extrusion node is as below.
    upload_2021-7-19_19-46-17.png

    Is there any way to avoid this?
     

    Attached Files:

  38. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
  39. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Plaximo, DanjelRicci and atomicjoe like this.
  40. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    Hi,
    How to get next frame's position and rotation in advance from existing spline controller? These values come in handy for moving platform implementation.
     
  41. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi
    First, store your controller's Position. Then make you controller advance by one frame by calling yourController.ApplyDeltaTime(yourFrameDuration)
    Then use whatever data you need, and then finally reassign the Position that you have stored in the beginning.
    This method is good as long as you don't care about the events and connections being handled by your controller when you call ApplyDeltaTime.
    Did that work out?
     
    spark-man likes this.
  42. spark-man

    spark-man

    Joined:
    May 22, 2013
    Posts:
    96
    Yes it worked out. Thank you so much.
     
  43. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    You are welcome. If and when you feel like it, please leave a review for the asset, that helps a lot.
     
    spark-man likes this.
  44. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    250
    Hello @Aka_ToolBuddy, I'm having problems with a generator and keep getting the same error:

    upload_2021-9-1_11-16-1.png

    [Curvy] Getting data from a dirty module. This shouldn't happen at all. Please raise a bug report. Source module is Rasterize Path (FluffyUnderware.Curvy.Generator.Modules.BuildRasterizedPath)

    The generator is part of a prefab. I'm not sure what the intended workflow for prefabs is, though, but I want to reuse this generator in different scenes with different source paths and slightly adjusted values.

    When I open the prefab to edit it, after a short while of working all connections disappear and I can only fix it again by reverting the prefab to a previous version.
    When I edit the generator on the prefab in the scene, I get the above error all the time. It feels like prefabs aren't supported, but I really need a way to keep making adjustments without having to do all scenes over and over.

    Can you help me?
     
  45. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    250
    Oh, and another (unrelated) thing. Is it possible to ignore bounds for spacing when creating a spots volume?
    I couldn't find a way yet and without bounds, it doesn't work. I'd like objects to spawn let's say every 5 units, no matter their size.
     
    Last edited: Sep 1, 2021
  46. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Hi Orion

    Since the (not so) new prefab system, Unity forbids some modifications on prefab instances, such as deleting an object that is part of a prefab instance. To do such modification, you will have either to unpack the prefab instance (ie: remove its link with the prefab asset), or you will have to delete the object inside the prefab asset.

    When it comes to Curvy, Curvy Generators do create and delete objects, such as the mesh resulting from a shape extrusion. When a generator is part of a prefab instance, such deletions are in conflict with the restrictions made by the new prefab system. When Curvy detects such conflict, it shows a console error. Did you get such error?
    • If yes, please modify your prefab asset to remove all the generated meshes and game objects from it. You can recognize them as the children of your Create Mesh and Create GameObject modules.
    • If no, then your issue might be different, in which case can you tell me what error messages you do have, and can you send a reproduction case?
    Curvy 8 will fix this issue
     
  47. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    For this one I need a reproduction case.
     
  48. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    The Volume Spots has a Space Before and Space After parameters, which I believe will answer your need: https://curvyeditor.com/documentation/generator/modules/volumespots#space_before
     
  49. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    250
    Ah, great. It looked like it was offset by the bounds, but I was mistaken. My bad.

    Yeah, the problem is not the objects being created/deleted. I had that sorted out. The problem is that if I open the prefab, and add new nodes, things break, and if I don't open it and add new nodes, things also break (but differently).
     
  50. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    527
    Ok, so this is an issue new to me. Is it possible to have a reproduction case?