Search Unity

[RELEASED] Curvy: Fast Spline Interpolation

Discussion in 'Assets and Asset Store' started by Jake-L, Feb 14, 2013.

?

Is it fine to release Curvy as a Unity 4.2 package?

Poll closed Dec 27, 2014.
  1. YES, I'm already using Unity 4

    103 vote(s)
    88.0%
  2. YES, but it should work in Unity 3.5 nevertheless

    7 vote(s)
    6.0%
  3. NO, I don't have Unity 4 installed and won't be able to access it in the AssetStore

    7 vote(s)
    6.0%
Thread Status:
Not open for further replies.
  1. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Got a problem with the SplinePathMeshBuilder and Pivot Centering.

    I have a spline that has a SplinePathMeshBuilder. When I click on the Center Pivot button, the extruded spline goes to the Vector3.zero.

    While researching the Curvy's pivoting, it seems that the curvy transform is always at the world's origin, as points are added to the spline, the center of the spline doesn't change, it only changes when centerPivot() is called.

    Small Request:
    1. Add an option to automatically create a pivot at barycenter when points are added.

    Here is a video of the SplinePathMeshBuilder pivoting.

    https://dl.dropboxusercontent.com/u/48378123/CurvyPathMeshPivotProblem.mp4
     
  2. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    The SplinePathMeshBuilder has an option whether it should use global or local coordinates, doesn't that help?
     
  3. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Great, I set it to World and it worked.

    Do you think it's possible to do:

    1. Add an option for the Spline to automatically create a pivot at barycenter when points are added.

    Thanks.
     
  4. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Sure, I'll add AutoCenterPivot as an option in a future version.
     
  5. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
  6. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Damn nice editor! While you don't just close the track spline when the user clicks or doubleclicks on the starting CP again?
     
  7. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Very cool Editor.
     
  8. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    Thanks! its old version on video, you can close track there already)
     
  9. zephren

    zephren

    Joined:
    Dec 7, 2012
    Posts:
    25
    Why don't I get collision on the meshes that are created?

    How do you get collision to work with the paths and roads ou make
     
  10. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    i attach meshcollider after road generated, not before then it will work.
     
  11. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Unfortunately I won't be able to do any forum activity for the next week(s) (approx. 2 weeks) due personal reasons.

    I deeply apologize for this temporarely unavailibility of support!

    Jake
     
  12. pixlweaver

    pixlweaver

    Joined:
    Dec 21, 2012
    Posts:
    92
    Hopefully I'm just missing a simple step but I can't seem to figure out how to properly export a spline mesh. I would like to create a shape and save it as a prefab to use in my actual level scene. However, if I save the mesh gameobject as a prefab, the mesh is not saved with it. If I export the mesh as an asset, the asset file disappears when I close the scene I saved it from.

    I am using Unity free version. Is that why I can't save meshes?
     
  13. zephren

    zephren

    Joined:
    Dec 7, 2012
    Posts:
    25
    oh, makes sense, thanks
     
  14. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Hi Jake,

    Hope all is well,

    In the past few weeks I've been using the mesh extrusion of curvy quite a bit and have ran into a real show-stopper. Here is a video to show the problem.

    https://dl.dropboxusercontent.com/u/48378123/MeshExtruderProblem.mp4

    Can you suggest what I can do to fix this because the code I'm working on cannot progress until the bug in Curvy is fixed.

    Cheers.
     
  15. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Hi Rocki,

    Yes, had some serious health problems with our newborn, but now everything is cured and fine.

    Please try setting the initial orientation of your source spline from "MinAxis" to "ControlPoint", this should solve your issue.We perhaps set that setting to be the default in the next version, as "MinAxis" isn't very predictable.
     
  16. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Glad to hear that everything is Ok and newborn is healthy. Big Relief.

    As for the fix, I tried "ControlPoint" and in the test scene it works. Only thing is that when I tried it in my existing code base, many things broke, turns out that my code has been setup to work with "MinAxis" and changing it to "ControlPt" is causing great pains. Spent quite a few hours trying to fix but not very successful.

    Can you have a look at the problem with "MinAxis" in Curvy. Perhaps its a bug that can be fixed easily in curvy.

    Cheers.
     
  17. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    What MinAxis does is to set the initial orientation to the axis with the smallest difference to the spline object. It's a good starter (that's why it's the default value), but not always what you want. If you switch to "ControlPoint" you have full control by setting the rotation of the first CP. This needs to be done by yourself as Curvy can't know what you're after.
     
  18. RvBGames

    RvBGames

    Joined:
    Oct 22, 2013
    Posts:
    141
    Can anyone get Interpolate to work with looping? For some reason I cannot get this to work. Looping works fine using MoveBy but not with Interpolation. Am I doing something wrong then?
     
  19. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Thanks for explaining, I didn't understand what MinAxis really does. But it seems that once the orientation is set to MinAxis, the orientation should be fixed.

    What I still don't understand is that once the orientation is set to MinAxis, why is it that when the spline is rotated the orientation lines still continue to change and the extrusion gets messed up? It seems that once we chose either MinAxis or ControlPt as the initial orientation, it should take this value and keep it even when the spline is rotated.
     
  20. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    I managed to fix my problem by setting in code:
    curvy.AutoRefreshOrientation = false;

    This seems to only work in code and not the editor.. Luckily I'm not using the Editor.
     
  21. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    The TF parameter of Interpolate() (or to be more specific, the TF parameter of TFToSegment(), which is called by Interpolate() ) is clamped in the range 0..1. This is by design. We might change that behaviour in the future, but need to check this internally to see if there are any unwanted side effects.

    Call Interpolate with the remainder and you should be fine!
     
  22. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Because MinAxis uses the current rotation, the result changes when you rotate the spline! The editor refreshes the spline when you change settings (or move/translate/rotate the transform of the spline), so MinAxis is calculated again.
     
  23. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Thanks for the explanation..

    "Because MinAxis uses the current rotation".

    This makes perfect sense.
     
  24. DesertRaven

    DesertRaven

    Joined:
    Jul 15, 2012
    Posts:
    137
    I just bought this asset, fired up a new project and got this warning:
    Assets/Curvy/Editor/CurvySplineSegmentInspector.cs(529,14): warning CS0618: `UnityEditor.Undo.RegisterSceneUndo(string)' is obsolete: `Use DestroyObjectImmediate, RegisterCreatedObjectUndo or RegisterUndo instead.'

    What to do? Unity 4.3.1f1 Pro


    Thanks
     
  25. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Just ignore it for now. These warnings are related to the changed Undo system in Unity 4.3. The next update will address this issue.
     
  26. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    hello jake
    bought curvy and it look very powerfull so far, i was interested on created spline in runtime in my mind, but i m still a noob, i d like to draw a path with the mouse so the cube would follow, was wondering if it s possible to achieve that with your asset?
    so far the closest demo scene i find might be the dynamicspline scene. so i need to investigate it, but if you have any hint i would really appreciate it.
    thanks
     
  27. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Sry, missed your post. Yeah, the DynamicSpline example does exactly what you want. Just have a look at the code and feel free to ask specific questions (preferable in our support forum).

    Jake
     
  28. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I purchased Curvy yesterday. I had been using iTween to instance and animate prefabs along a path. But it was a lot of work and I didn't have a lot of control. I look forward to exploring and leaning Curvy, but unfortunately I'm short on time and need a solution. How would I create a continuous flow of prefabs along a path. An example or starting point would be great. Thanks.
     
  29. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Is there a way to animate a SplinePathCloneBuilder?
     
  30. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    What part of do you want to animate?

    Regarding your first question: you can for exampel add a SplineWalker component to your prefabs. However, I can give you more detailed advice if you specify what exactly you understand with continuous flow.

    Jake

    PS: Perhaps consider to register in our support forum.
     
  31. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    first question: Yes, I plan to instance prefabs and assign a spline at that time. Also size, color and speed the prefab will travel down the spline. By continuous flow I mean one after another. Like large arrows indicating direction down a hallway.

    Second question: Currently the user picks size, color and speed and starts the animation. It takes a short while for the prefabs to populate the spline. If I use 'SplinePathCloneBuilder' the user can see what the path will look like before beginning the animation. SplinePathCloneBuilder is a static version of what I am creating with an animation. Can I just 'start' the prefabs at the locations they are on the spline. So the user wouldn't have to wait for the spline to be populated with the prefabs?

    Thank you for your time. I will join the support forum.
     
  32. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    You should be able to utilize the SplinePathCloneBuilder for this purpose. First, disable it's AutoRefresh (and call Refresh() manually everytime you change the spline). In your prefabs, add a SplineWalker component (this will animate the object along the spline).

    Never tried this, but should do the trick. Animating a path makes a good example scene, I'll set it on my ToDo list.
     
  33. username_

    username_

    Joined:
    Sep 27, 2013
    Posts:
    9
    Hello

    Is it possible to use curvy for splines that follow the curves of a terrain?

    Is it possible to align one spline to another so they run parallel?
     
    Last edited: Feb 5, 2014
  34. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    @Jake,

    Wondering if you could give an idea of what's included in the next update.

    Cheers.
     
  35. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Not directly. Aligning to terrain/any geometry is on our roadmap, though. But in both cases you can easily add a custom script that move Control Points to match some rules like terrain picking or aligning to another spline. Send me a PM if you need more advice on how to achieve this.

    Of course:


    • 4.3 compliance (using the new Undo system to get rid off the anoying warnings)
    • Rewritten UI (Toolbars, ad-hoc editing improvements, hotkeys toolbar can be easily customized by users)
    • (Most likely) Networking components (like in Railroad network), so basically moving around a network of connected splines including pathfinding. (this time using a solid approach, making the current Tag-system obsolete)

    Don't ask me for a date...we know that the update is overdue, but you won't be disappointed.

    Jake
     
  36. dream19

    dream19

    Joined:
    Feb 13, 2014
    Posts:
    39
    Hello everyone!

    I have a question about Curvy: can you dynamically adjust the traveling speed along a curve?
     
  37. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Of course. The provided components have a Speed float property that you can animate/change at will. Also, it's pretty easy to add spline travelling into your own scripts, so you're not bound to use the provided scripts.
     
  38. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    211

    I want to attempt the same thing, I have already done it using my own strange setup - and would like to try to make use of a clean Character Controller, fully controlled by Curvy, apart from Y axis.

    I think older versions of Curvy had an example scene of doing this, but it appears not to be there any more?
     
  39. UnityFS

    UnityFS

    Joined:
    Feb 10, 2013
    Posts:
    127
    Hi Jake,

    I have just purchased Curvy. I am noticing however that when moving Spline control points using the standard unity editor translate gizmo, the position changes do not seem to be undo-able / or register with the undo manager. Is this a known issue?

    I seem to have a habit of grabbing and moving them unintentionally :)

    Thanks,
    Chris
     
  40. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    The old example was a strange setup as well. We reworked it and it's now known as EndlessRunner example.

    Yes, Unity 4.3's new Undo system will be fully supported with the next release.
     
  41. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    211
    Thanks for the answer, but:

    A) The EndlessRunner example is apparently not there using Playmaker - though you wrote "..starting with 1.04, all example scenes will be done as playMaker FSMs as well.".

    B) The EndlessRunner example is not using Character Controller as far as I can tell.

    C) The EndlessRunner example is quite buggy; Try to jump a few times, quite often that puts the game in a state of strange flickering up and down every second frame, so it's not really a good example, I think.
     
  42. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    71
    Hey Jake,

    I found a video that shows the exact functionality i'm after in Unity, take a look:

    [video=youtube_share;q0MFc_72m6k]http://youtu.be/q0MFc_72m6k

    Would you be able to implement a system or script like this in Curvy? I'd be more than happy to pay for it!

    Cheers,

    Simon
     
  43. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    No, and I don't see the need for it in a railroad-type example like this.

    It sounds like you want a ready-made custom controller that does everything you need and just needs to be plugged in your game. That's not the point of an example. But the example indeed shows several techniques to use Curvy's API for such type of controllers. So use it as a reference to build the controller you exactly need.

    Regarding playMaker: we have done most examples in FSM's. However, converting more complex setups like the Endless Runners into plain FSMs without extra scripts isn't that easy. And even if we would do that, the result would be way too complex for an example. In our opinion Playmaker is a tool to manage Finite State Machines, not a visual coding language replacement. But we ensure that Curvy's API is accessible from PlayMaker's FSM. If you're into "coding" everything graphically, you can using the provided custom actions.
     
  44. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    Sure, but unfortunately I don't have the time to do that.
     
  45. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    211
    Well, yes, sorry - I just figured that since the example should show how to do things, it should work when doing these things. I'm not asking for anything that just needs to be plugged into my game, I'm just pointing out that the example is buggy in the core functionality. So it's not showing how to do things when it's flickering all over, is it? More like not how to do it.

    Fair enough, I merely quoted you for writing earlier that "..starting with 1.04, all example scenes will be done as playMaker FSMs as well."

    This is no longer the case then.

    If we put on the happy hat again, I'm sure we could find ways to get the PlayMaker community, or even developers to make the parts you find too complex for PlayMaker.
     
  46. PassivePicasso

    PassivePicasso

    Joined:
    Sep 17, 2012
    Posts:
    100
    Avrigus,
    Is there any specific aspect of this you're looking for?
    Is it the way that the user is setting up the control points?
    The way the curve is projected a certain distance?
    Perhaps the way the character is bound to the X and Z coordinates of the curve, but moves freely with gravity along the Y coordinates?
    Is it every aspect?

    A solution for your needs may be simple, and if so, would certainly be faster than waiting for the Curvy developers to update the systems to support the features.
     
  47. S0ULART

    S0ULART

    Joined:
    Jun 14, 2011
    Posts:
    131
    Hello Jake
    I want to achieve the following movement on a curvy spline:
    I've got one object freely moving on a map and a Spline. On that spline is another object that moves along it. My wish is now that the object should move always in relation to the freely moving one on specific distance so it follows the other object to be near it but is bound to it's movement on the spline.

    how can I achieve this? I'm using Playmaker with the Curvy pm actions.
     
  48. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    The easiest would be to get the nearest point on the spline from your freely moving object, then move the spline object there. If the spline object need some extra conditions (minimum distance etc..) you'll need some extra math.
     
  49. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    71
    Hey PP,

    Ideally I would like the exact functionality you see in the video. I want to be able to lay down a spline under my level geometry and have my game character follow it invisibly, like a hidden rail. So pretty much like you said; the character is bound to the X and Z coordinates of the curve, but moves freely with gravity along the Y coordinates.

    I asked the creator of Megafiers this same question and he is now working at a script with this exact functionality in his next release. He posted the below video of his progress:



    I would really like to see this simple functionality in Curvy!
     
  50. Jake-L

    Jake-L

    Joined:
    Oct 17, 2009
    Posts:
    397
    So why you don't start to create this simple functionality by yourself and ask for help in our support forum if you got stuck or need advice on a particular problem. It's not that complicated, even with playMaker and if you come up with something by yourself me and others would be pleased to help you. Imho just requesting custom solutions from several developers isn't the best way.
     
Thread Status:
Not open for further replies.