Search Unity

[RELEASED] Curvy 2 - the ultimate spline solution

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

  1. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    The code was completely rewritten with the release of 2.0. That explains the names differences
    Wasn't aware of the existence of this asset. With Curvy 2.x, a pooling system is included within Curvy, so you will probably not need to use PoolBoss.
    There is an upgrade guide, from 1.6x to 2.x, in Curvy's website. Here is its link: https://curvyeditor.com/documentation/upgrading
    I highly recommend you to upgrade to 2.x. especially to use what I think is one of the main features of Curvy, the Curvy Generator.
     
    Last edited: Feb 5, 2018
  2. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,679
    The link is invalid.
     
  3. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Sorry. Fixed it
     
  4. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,679
    @Aka_ToolBuddy Should I completely remove the old version before installing the new version? The upgrade guide does not give guidance on that.
     
  5. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Yes you should. Keep a backup of your old version though, might be useful for you at some point.
     
    magique likes this.
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,679
    Strange, upgrading isn't working for me. I removed the old version and installed the latest, but it can't seem to recognize the FluffyUnderware.Curvy.Controllers namespace.

    upload_2018-2-6_7-31-13.png

    It only shows ThirdParty.
     
  7. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    FluffyUnderware.Curvy.Controllers is definitely part of the package. You can find classes that are part of that namespace in the Packages\Curvy\Controllers folder.
    What I suggest to you is:
    1. create a new project
    2. import the latest curvy in it, and make sure it builds (it should)
    3. include in it little by little parts of your project, until finding what is wrong
    4. Fix the found issue, and get back to point 3. If you can't fixe an issue, send me a copy of the minimal project having the issue, and I will try to help you fixing it.
     
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,679
    It totally broke my project. I removed any of my own classes that referenced Curvy and still it wouldn't work. In fact, it suddenly couldn't even find namespaces for other 3rd party assets I have such as Core GameKit. I'm trying an alternate solution for now. If that doesn't work out then I'll give this another try later. Thanks for the help.
     
  9. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    335
    Hi I purchased Curvy some time ago. Now I have a question.

    In my game I'm instantiating prefabs. These prefabs have Spline Controller script. I need a script that can find existing Curvy Spline in the scene and add that CurvySpline to my new instantiated Prefab's Spline Controller.

    So in the game there will be many prefabs using the same CurvySpline that I have created for them in the scene and they all need to be attached to this spline.

    Something like this:

    void Start()
    {
    SplineController.Spline = GameObject.Find("My Curvy Spline");
    }

    Any help?
     
  10. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Nadan likes this.
  11. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    335
    I ended up using this code in my game.

    Code (csharp):
    1.    public SplineController SplineController;
    2.  
    3.    void Awake ()
    4.    {
    5.        SplineController.Spline = GameObject.Find("Curvy Spline").GetComponent<CurvySpline>();
    6.    }
    7.  
    8.    IEnumerator Start ()
    9.    {
    10.        if (SplineController.Spline)
    11.        {
    12.        // Wait until the spline is fully intialized before accessing it:
    13.        while (!SplineController.Spline.IsInitialized)
    14.        yield return null;
    15.        // now we're safe to use it
    16.        SplineController.Play();
    17.        }
    18.    }
    It works but..

    When I instantiate the gameobject (from Resources folder) with this script I get this error/warning:

    "[DTSingleton] Something went really wrong - there should never be more than 1 singleton! PLEASE INFORM THE AUTHOR!
    UnityEngine.Debug:LogError(Object)
    FluffyUnderware.DevTools.DTSingleton`1:get_Instance() (at Assets/Packages/DevTools/Components/DTSingleton.cs:48)
    FluffyUnderware.Curvy.CurvySpline:Awake() (at Assets/Packages/Curvy/Base/CurvySpline.cs:575)"

    I won't stop the Curvy from working but dosn't sound good and it's asking to inform you.
     
    Last edited: Feb 12, 2018
  12. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Thanks for informing me. I created a ticket for this issue. It should be resolved soon, probably at the next update.
     
    Nadan likes this.
  13. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    335
    Hi,

    I have new question. In my game the player moves along the path that will go round in circles and up and down.

    My problem is that I need my player to be always facing up. Lets say I have a character standing on a plane. If the plane tilts in any way the player drops off. And right now the plane tilts left and right when turning in corners. So in a way I only want the player object to rotate sideways as it follows the path. Like only the Rotation Y value would change in the inspector but the X and Z values would stay zero.

    My path has Static orientation and the interpolation is Bezier. I have tried to adjust by hand all the Control Points so they would face up. But I was wondering if there was better way to do this? Do I need to adjust the Spline itself or do I need to change something from the Spline Controller?
     
  14. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    In the Spline Controller inspector's, there is an Orientation section. This sections let's you define how the controlled object should be oriented. The default behaviour is that the object's up is aligned with the spline's up.
    • If you keep that default behaviour, you will indeed need to modify the spline's orientation to fit your needs:
      • Either you set the orientation to static, and then will need to modify control points' orientation, like any game objects' orientation
      • Or you set the orientation to dynamic, and then use the "Orientation anchor" feature to tie multiple orientations to one CP (control point), which will allow you to modify all the CPs' orientations by modifying only the CP marked as orientation anchor.
    • You can modify the controller's orientation options, by telling it to allign the controlled object's forward with the spline's tangent, which might be helpful in your case.
    Here are some useful resources:
     
    metroidsnes, blitzvb and Nadan like this.
  15. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
  16. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    335
    Hi,

    I'm trying to use the OnEndReached event in my script. How can I check during gameplay if the end has been reached? I need to do stuff when the end has been reached.

    I tried to look at this but I don't understand it. :/

    https://curvyeditor.com/documentation/controllers/events#onendreached

    I used this for now:

    Code (csharp):
    1. void Update()
    2. {
    3.  
    4.        if (MySplineController.RelativePosition > 0.9f)
    5.        {
    6.            Debug.Log("End has been reached!")
    7.        }
    8.  
    9. }
    But there must be better way to do that.

    I tried if (MySplineController.OnEndReached == true) but it's not boolean and that's not the way it works.
     
  17. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    OnEndReached is a Unity Event. I highly advise you to read this documentation to understand what a Unity Event is: https://docs.unity3d.com/Manual/UnityEvents.html

    To sum up, is like a receptacle for functions. Whatever function you put in will get called every time the end of a spline is reached. The functions to fill OnEndReached with should look like this:

    void YourFunction(CurvySplineMoveEventArgs eventArgs)

    You can see the event being used in TrainCarManager.cs, in the setController method.
    Also, the example scene 03_Connections.unity uses events, not OnEndReached but similar ones.
     
    Nadan likes this.
  18. callen

    callen

    Joined:
    Dec 31, 2013
    Posts:
    23
    Sorry if this has been answered already i didn't see anything so far...

    Im trying to instantiate copies of an object. The root object has a child which is a curvy spline and another child which has a spline controller to follow that spline.

    Whenever i rotate the root, the rotation of my object with the spline controller gets messed up.

    The spline looks like it is rotated correctly in scene view but the up vector of my spline controller object doesn't match the up vector of the spline. I tried messing with the properties on the spline controller to no avail. Any ideas? Thanks!
     
  19. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Yep, that's a bug. Until it is fixed, probably in the next release, you can either:
    • Make the controller object not a child of the root object
    • Modify the code by replacing this:
      protected virtual void ApplyTransformRotation(Quaternion rotation)
      {
      Transform.localRotation= rotation;
      }

      with this
      protected virtual void ApplyTransformRotation(Quaternion rotation)
      {
      Transform.rotation = rotation;
      }

      in CurvyController.cs

      I haven't properly tested this fix yet, so if you see any side effect, please let me know
     
  20. ColtonK_VitruviusVR

    ColtonK_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    148
    Hey All,
    Bit of an odd question, but can you extend splines beyond 0-1? I am currently using curvy to dynamically throw a ball at the player. The first CP is where the ball starts, second is midway with some added height for a nice curve and the final point is the player chest. I would like to somehow extend the spline to the ground (and intersect the players chest) so the ball doesn't hang in mid air when it reaches the end.
    Thanks,
    Colton

    EDIT: I was able to extend the spline to the ground using the tangent at the end, raycasting down to find the ground and putting the point there. This works OK but changes the curve, ideally I would like to put the point on the ground without changing the curve
     
    Last edited: Mar 9, 2018
  21. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    If you use a Spline Controller, you can use the "On End Reached" event to define a custom behavior when the ball reaches the end of the spline. You can for example make the ball use physics to bounce on the player chest. Or you can make it follow another spline to fall in a controlled way.
    To strictly answer your question, no there is no way to go beyond 0-1, since 1 is the end of the spline. If you want to extend the spline, you will have to add new Control Points.
    Let me know if my answer is not clear enough.
     
  22. ColtonK_VitruviusVR

    ColtonK_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    148
    Thats what I figured, is there anyway to calculate where that last control point should be so it doesn't change the curvature of the spline?

    Cheers,
    Colton
     
  23. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Sorry, there is no such thing in Curvy out of the box. You will have to learn the maths behind the spline type you use, and make the extrapolation code using the data Curvy provides (the CPs positions, the Bezier handles, etc)
     
  24. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Hi, I'm making a racing game and Curvy turned out to be invaluable tool for creating race tracks.

    The problem that I have now is that when I'm scaling the track and track walls on x axis (to make some sections narrower), the walls change their shape (they get thinner). How can I preserve track walls shape and align them along scaled track at the same time?

    Here're pictures of my setup and the track:



    Here only the track is scaled. Track wall are not, and they're not aligned with the track.



    When I scale also the track walls, they align with the track but also their shape changes (gets scaled what results in thinner walls):



    Thanks!
     
  25. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    I see two ways to do what you try to achieve
    a- Use a different spline for the walls. This solution is not perfect, since you will have to modify the walls' splines each time you modify the track.
    b- Create a Curvy Generator module (or modify an existing one) to make the extrusion's cross shape translate using an animation curve similar to the one used to set the x scale. This solution needs coding, but has the advantage of avoidind you the work of updating the walls whenever you update the track.

    Right now I am on vacation, with no access to a computer, so I can't do much more to help you. As soon as I will be back to work, early april, I will contact you again.
     
  26. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Thanks for reply! I was thinking about using the TRS Shape modifier to offset track wall but unfortunately there's no option to transpose using animation curve. I'll see if I can implement that.
     
  27. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    From memory, a good spot to start would be the biggest method (called Refresh?) in ShapeExtrusionModule
     
  28. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Thanks for the tip. I made some simple implementation, seems to work ok when scaling and rotation the track. But still there're places where the wall doesn't entirely stick to the track (there's a really small see-through gap) so probably I'm doing something wrong.

    I attached git patch for Curvy 2.2.2.

    btw. It's not a priority for me, atm I can live with the scaling solution. Have fun on your vacation!

    https://pastebin.com/patEsQiv
     
  29. SteffanG

    SteffanG

    Joined:
    Sep 15, 2014
    Posts:
    2
    Sorry if this isn't the correct place to ask but, does Curvy Splines work in Unity 2018? If not, will it be updated soon?
     
  30. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    Sorry for the late answer, just came back from vacations.
    If you use the current Curvy version (2.2.3) with Unity 2018, you will get:
    - a warning when compiling Curvy, stating that a method is obsolete and should be replaced.
    - invalid shaders in some example scenes, since Unity 2018 discontinued support for Substance shaders.
    Both these issues do not impact the workings of Curvy, so you can use it without problem.
    Curvy 2.2.4 will fix the issues above.
     
  31. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hey everyone
    Curvy 2.2.4 is live. This is the biggest update to date in the 2.X cycle. Performance got improved a lot. Some operation now take a two digits fraction of the time it took before. I hope you will enjoy it.
    As always, the release notes are here: https://curvyeditor.com/releasenotes
    Have a nice day
     
    blitzvb, jmjd, red2blue and 1 other person like this.
  32. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    I tested the following implementation, and couldn't see any see-through gap. Let me know if you find any:
    https://pastebin.com/J1Te0BGi
    There are 3 fields to setup: the width of the track, the scale curve used for the track, and a boolean to define the direction of the correction.
    The gaps you have might be because of difference between the track mesh resolution and the one for the walls. I attached an expert's drawing of what I mean :)

    ThisIsArt.png

    The gray area is the track (seen from top) and the green one is the wall. The white area is the gap. They are both following the spline, but with different resolutions.
    If this is indeed what's happening, you should set the same rasterization parameters for both the walls and the track to align their vertices
     
  33. metroidsnes

    metroidsnes

    Joined:
    Jan 5, 2014
    Posts:
    63
    Hi, I tested it with scale 0.5 and couldn't see any gap (tested for both walls). For me it solves the problem, thanks! Will it be included in the next release?


     
  34. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Happy to hear that.
    I plan to include the feature in Curvy, but not as I implemented for you. The way it was implemented makes sense for your specific need, but not for the average user. The feature will probably be included in Curvy as a modification of the TRS Shape module, or a brand new module. Either way, this is not planned for the next update.
     
    metroidsnes likes this.
  35. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
  36. nubdev

    nubdev

    Joined:
    Mar 30, 2013
    Posts:
    60
    I am getting the following errors trying to import Curvy into an existing project:

    ...CurvyCamController.OnEnable()' is marked as an override but no suitable method found to override
    ...Curvy.CurvyClamping)' is marked as an override but no suitable method found to override
    and the same error for a bunch more scripts out of Curvy Examples folder

    Importing into a new project is fine, this is just happening when sticking into an existing project.
    Obviously a deal breaker in terms of using it since I cant compile or test with the errors present.

    using unity 5.6.4f1

    Any assistance would be appreciated thanks
     
  37. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    Try removing the old Curvy folder in the existing project then re-importing the latest Curvy version. If the issue is still there, can you send me please the complete errors logs, and tell me what version of Curvy the project was using before the update.
     
  38. nubdev

    nubdev

    Joined:
    Mar 30, 2013
    Posts:
    60
    Just updated to the latest Curvy, deleted the last, then imported the updated files but its still the same issue. Tested version 2.1.3 and now 2.2.4.1

    errors shown in pic
    curvy.jpg
     
  39. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    All the classes triggering errors inherit from SplineController. Do you have this class in your Assets\Packages\Curvy\Controllers folder? If yes, can you please send me your SplineController.cs via PM?
     
  40. nubdev

    nubdev

    Joined:
    Mar 30, 2013
    Posts:
    60
    Just started a conversation (think thats PM?) and pasted the splineController.cs, thanks

    edit- I can send you the additional cs files (motor controller and curvy controller) you're asking for but they are straight from the asset store so I dont know why they would be different or be causing the problem... Thanks for the help so far, though I cant linger and will just be forced not to use Curvy given there is an obvious compatibility issue with other assets already in use.

    edit - just sent the files, thanks for your continued help.
     
    Last edited: May 8, 2018
  41. nubdev

    nubdev

    Joined:
    Mar 30, 2013
    Posts:
    60
    I just got it working by moving all the Curvy folders and files into a "Plugins" folder. Thanks for the help though
     
  42. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    So it was a compilation order issue then. When you had the problem, where you putting the Curvy's example scripts in the plugin folder while keeping the the remaining Curvy folders outside of it?
     
  43. nubdev

    nubdev

    Joined:
    Mar 30, 2013
    Posts:
    60
    The default state of Packages > Curvy / Curvy Examples etc is what was throwing up the errors, didn't experiment to see moving just the scripts folder into "plugins" would help as it fixed itself after moving everything. thanks
     
  44. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Thanks for the details. I can't see why that happened. If you encounter any other issue, please let me know.
    Have a nice day
     
  45. utkarshdwivedi3997

    utkarshdwivedi3997

    Joined:
    Aug 11, 2017
    Posts:
    17
    Hey, I'm considering buying this asset, but I'm wondering if this asset has compatibility for UWP builds as well as Nintendo Switch/PS4 builds?
     
  46. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    Curvy builds on UWP.
    About Nintendo Switch and PS4, I have never build anything on such platforms, but I don't think Curvy will have any issue building on them. Curvy already builds on desktop standalone, mobile and webgl, so I guess that most platform specific issues are already solved.
    If you buy Curvy and find any issue on PS4 or Switch, please let me know and I will try to fix it asap.
     
  47. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hey everyone
    Curvy 2.3.0 is live. It includes a lot of improvements regarding controllers. Also, some controller functionalities are deprecated, so please read the release notes before updating https://curvyeditor.com/releasenotes
    Have a nice day
     
  48. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    83
    Hey all,

    We used Curvy in Trailblazers (http://www.trailblazersgame.com/) and it worked a-ok on console platforms. We didn't do a massive amount of runtime stuff (most of our Curvy-related stuff was done at edit-time), but the runtime bits we did use worked just fine.

    Hey ToolBuddy, we're continuing to use Curvy for our next project - it's great. It has been fun to sync up to the latest version and see which improvements you made since inheriting from Jake... excellent stuff. Can I make a small feature request please? I often want to scale a Bezier spline, and we almost always have custom handles which fail to scale with the object scale. It would be great if they did.

    In other words:
    -Select all the nodes of a Bezier spline with custom handles defined.
    -Use Unity's scale tool to increase the size of the entire spline.
    -Observe how the handles stay at their previous small size.

    I wrote an Editor script to automate resizing the handles, but it's a pain. Any chance you could make the handles scale along with the overall object scale please? That would be awesome.

    Keep up the good work!

    Ben
     
  49. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    134
    Hi,
    I am glad to know that Curvy is making your work easier.
    About Bezier handles resizing, I added this feature to the backlog. I don't know yet when it will be implemented, but I will make sure to let you know when it will be.
    Thanks, and keep up the good work too.
     
  50. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    83
    Great stuff, thank you!

    Ben