Search Unity

SplineBend - object deformation tool

Discussion in 'Assets and Asset Store' started by Wright, Feb 27, 2013.

  1. EmeralLotus

    EmeralLotus

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

    Ok, I understand you do not want to deal with multiple materials or colors.

    On a Mesh Level, can you offer some suggestions how I can modify SplineBend so that it can create submeshes for each tile.

    Thanks.
     
  2. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    Do you, by any chance, work on a C# version of the scripts?
     
  3. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Strange coincidence - just answered the same in voxeland thread )

    I guess you need C# version for calling splinebend functions from your c# scripts. But you can call them without converting - you can call javascript functions from your c# files. The only requirement - SplineBend should be compiled first, so it has to be inside Standard Assets folder.
     
  4. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    Nevermind. Seems to be working.
     
    Last edited: Sep 3, 2013
  5. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Just leave Editor folder outside Standard Assets...
     
  6. CaptainChristian

    CaptainChristian

    Joined:
    Apr 3, 2013
    Posts:
    100
    Alright, I got it working. Something that bugs me is the following message
    Look rotation viewing vector is zero
    UnityEngine.Quaternion:LookRotation(Vector3, Vector3)

    in line 291 of the file SplineBendEditor.

    Most of the meshes are looking as expected, tho. Any idea how I can solve this issue?
     
  7. WalterEspinar

    WalterEspinar

    Joined:
    Aug 23, 2011
    Posts:
    84
    Hi, this tool work with multiple terrains? for example for roads that cross in two terrains?
     
    Last edited: Sep 14, 2013
  8. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    It will, but please note that these terrains must be in one layer (a collision layer, I mean).
     
  9. EmeralLotus

    EmeralLotus

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

    Can you please at least answer this question, I asked it 3 weeks ago.

    "On a Mesh Level, can you offer some suggestions ( you don't have to do it, just some ideas) of how to go about modifying SplineBend so that it can create submeshes for each tile. "

    Thanks.
     
    Last edited: Sep 15, 2013
  10. EmeralLotus

    EmeralLotus

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

    SplineBend is really a great package, would it be possible to add an option for a closed path. Currently, in order to make a circular path or any closed path, we have to manually align the end markers which is very difficult and still does not work well. Very much appreciate it if this could be added in a future SplineBend update. If anyone else else thinks this is a good idea, please send in your comments.

    Thanks.
     
  11. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    I tried to use SplineBend but I think that it won't work on objects like cylinders and spheres. What should "Initial Render Mesh" and "Initial Collision Mesh" be set to? Let's say that I want to turn a 3D model of a tree created from cylinder and sphere into spline. The name of the 3D model is "tree01".
     
  12. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Are you using the Unity primitives?
     
  13. jeffmorris1956

    jeffmorris1956

    Joined:
    Jul 3, 2012
    Posts:
    276
    I am using the Unity primitives. I found out from a side view that the red balls are on top of each other.
    $splinebend.PNG
     
  14. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    I am not sure about this, but I doubt that this plugin works with the Unity primitives.
    You much probably need to make a mesh in a 3D modeling program.
     
    Last edited: Nov 5, 2013
  15. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    SplineBend works with standard Unity primitives. Have you tried selecting and moving these red spheres?
    Initial meshes are the meshes used as a reference meshes or sources for the bended mesh. For Unity primitives they could be found in "Mesh" section in Mesh Filter of an unchanged (with no SplineBend) object.
     
  16. Deleted User

    Deleted User

    Guest

    Hi, I'm trying to execute the UpdateNow() function from another script but am not able to target the SplineBend component at all. In fact my script has no idea of SplineBend's existence at all, can anyone help me with this?
     
  17. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I guess you are using C#.

    You can call javascript functions from your c# files. The only requirement - SplineBend should be compiled first, so it has to be inside Standard Assets folder.
     
  18. Deleted User

    Deleted User

    Guest

    Yup, using C#.

    Thanks so much, worked like a charm.
     
  19. juangauthier

    juangauthier

    Joined:
    Sep 16, 2013
    Posts:
    10
    Great tool!

    Are you planning on adding support for meshes with multimaterials?? It would be one of the best updates ever in my own opinion!

    Juan
     
  20. FrenchToastFella

    FrenchToastFella

    Joined:
    Dec 9, 2013
    Posts:
    7
    A quick question, and a stupid one, but what resources are you using in your demo? :) Those trees and textures look awesome!
     
  21. JaimeAriz12

    JaimeAriz12

    Joined:
    Mar 6, 2014
    Posts:
    28
    Will this work on planes?
     
  22. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Ragethunder of Valhalla, those are my assets for company I'm working at, for a project named "Affected Zone".

    URMOM1, do you mean can SplineBend use planes instead of terrain? As long as planes have collider it can.
     
  23. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    That is the reason ) Unity changed undo system. The next SplineBend version will use it, and will not be compatible with pre-4.3.3 unity versions.
     
  24. serpin

    serpin

    Joined:
    Nov 13, 2011
    Posts:
    54
    Unity freezes if you try setting Drop to terrain - Seek distance to zero.

    Can be fixed by adding if(seekDist <= 0 ) return; at the top of the FallToTerrain() function.

    Also, dude, you really need to port this tool to C#... Your other assets are also amazing, but JS?.. Come on.
     
  25. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Thanks for finding out a bug!

    Poor js... Nobody loves it. Thats why I'm converting voxeland to c# now, and maybe do the same with SplineBend someday.
     
  26. sefou

    sefou

    Joined:
    Aug 30, 2011
    Posts:
    287

    Please. Thanks. :)
     
  27. serpin

    serpin

    Joined:
    Nov 13, 2011
    Posts:
    54
    There's a great asset available for converting JS to C#. It automates 90% of the process.
    I can definitely say that one of those saved my life when I needed to port my very dynamic and complex 2000-line character controller code to C# when I realized that JS, well, sucks =)
     
  28. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Hi there. I am having an issue where the mesh is set to drop to terrain, but of course as intended it is landing on top of models as well. But I don't want it to land on these models (trees). Can you add a feature to make it ignore meshes as well? Or even ignore meshes between selected markers?
     
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    You can select the layer number of object SplineBend will be dropped to. If trees and terrain will have different layers your object will be dropped to terrain only, ignoring other objects.
     
  30. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Ahh hey, not sure why I didn't think of that. Cheers for the tip!
     
  31. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Feature Request
    -Tell individual markers to not drop to terrain.

    I ask for this because my mesh being used as a path, I want the end pieces to dip into the terrain so they blend in with the texture on the terrain.
     
  32. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    As I understand the mesh should partly dropped to terrain and partly not, depending on the nearest marker setting with blending between markers with different settings. This is possible but rather hard to implement. I'll add this in my todo list anyway.
     
  33. wolfen231

    wolfen231

    Joined:
    Apr 22, 2014
    Posts:
    402
    Well when I use a flat mesh I have to raise it about 0.05 off the ground so it doesn't blend in with the terrain (as it aligns at 0 obviously). I made a mesh with a slight bend on its sides and using a texture with an alpha that fades so it looks some what natural. The end pieces however are raised and I can't pull the terrain up over them nor does pulling the control point down do anything.

    But yeah, if you could add that eventually that would be awesome. So far though this tool is amazingly useful. Im even using it on cliff walls to give different shapes, rivers, paths, all kinds of things. :D
     
  34. NightmarexGR

    NightmarexGR

    Joined:
    Jun 7, 2012
    Posts:
    217
    Hello , i am considering of buying this within the next 2 days and i would like to know if this is still in JS version cause i prefer JS and if it has any sort of errors or leaks ( memory leaks ) it is very important to me that it has no errors even harmless ones or memory leaks, i am creating a very sophisticated game and so far my only memory leaks come from Voxeland and i am very concerned about this :( So please if it has any of these let me know before i buy.

    Great job on all your assets Wright i am a fan of your work, keep up like this !!
     
  35. SGtRumpel

    SGtRumpel

    Joined:
    Mar 16, 2014
    Posts:
    13
    Hi there,

    thanks for the tool - after trying to work with EasyRoads, Road Architect and TrackBuildR I finally got this tool and it finally does, what I need :)

    Nevertheless, I have some suggestions for even improving the tool:

    1. Beginn and Endmeshes: You wrote that you can use the marker-array for placing end-meshes, but the problem is, it works only, if you use the spline itself for placing the object. If you drop your meshes to the terrain or if you use a custom Axis for rotation, the merker-objects are not in place to add end-objects.

    2. It would be great to be able to add multiple meshes to a spline. Imagine beambarriers in a game - with that feature you could easly create diverse side-objects combining different meshes. Using the same spline you keep the possibility to be able to re-position all objects simply by adjusting the splinemarker.

    3. It has been mentioned, that it can happen that you need multiple materials on one object. I ran into this problem, too. This also could be solved by the feature above.

    Greetz and keep up the good work!
     
  36. Deleted User

    Deleted User

    Guest

    is this working on unity5?
     
  37. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    gotstyle, unfortunately, no. Version 1.44 is not compatible with Unity 5. In next few months I'm going to re-write the plugin using C#, add bending in playmode, and add Unity 5 compatibility.
     
    Deleted User likes this.
  38. ioFlow

    ioFlow

    Joined:
    May 30, 2014
    Posts:
    16
    Hey everyone,

    What's the trick to getting collision going?

    I got a road mesh, drag it out easy enough, but then no matter what I try I can't get it to let the player walk on it :(
     
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    ioFlow, have you assigned an initial collision mesh in "Meshes" foldout? Anyways, I already started a plugin refactoring, but somehow distracted to Voxeland and Erosion Brush upgrade. If it is a bug the new version will most probably get rid of it.
     
  40. ioFlow

    ioFlow

    Joined:
    May 30, 2014
    Posts:
    16
    Hi Wright,

    Sorry, false alarm :)

    It was late, must have been tired.

    On trying again this morning I found I can drag in a mesh, put on a mesh collider, add splinebend and it all behaves...
     
  41. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    • Is this asset compatible with Unity 5?
    • Can this asset handle control points arbitrarity rotated on XZ axes? Specifically, something like pipes which can curl and start/end in any direction. Sample video showcased only roads and fences snapped to vertical axis, with control points rotated only on Y, hence my curiousity.
     
  42. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    I'm getting really strange shading artifacts in meshes produced by this asset. I'm not sure when this started happening. @Wright out of curiosity what exactly isn't working in Unity 5?

    EDIT - I figured out the issue was on my end. For anyone interested, Spline Bend appears to work perfectly in Unity 5.
     
    Last edited: Sep 7, 2015
    gameDevi likes this.
  43. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    How's it going with the re-factoring of the tool?
     
  44. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    One small thing that improved usability for me. Drop To Terrain is cool, but I find it useful to have markers stay at the height of the terrain as well, so you don't have to go into top-down view to see exactly where they are. In SplineBendMarker Init you could just add something like (would need to be converted to JavaScript - this is C#):
    Code (CSharp):
    1. RaycastHit hit;
    2. if (Physics.Raycast(transform.position + new Vector3(0, script.TerrainSeekDist * 0.5f, 0), -Vector3.up, out hit, script.TerrainSeekDist, 1 << script.TerrainLayer)) {
    3.     transform.position = new Vector3(transform.position.x, hit.point.y, transform.position.z);
    4. }
     
    Last edited: Mar 24, 2016
  45. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,266
    Has anyone managed to port this to C#? I've made several attempts myself, but can't seem to get everything up to snug.

    This has always been my go-to spline mesh tool, any of the spline tools I've tried recently simply don't measure up to this.
     
  46. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Has this been pulled from the Asset Store? Why?
     
  47. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Just because JS assets are no longer allowed, they are incompatible with the latest Unity versions.

    I'm surprised to know somebody is still using it. It very pleasant to know that. It's been a really long time... Five years, maybe more?

    Anyways, I'm making a spline system for MapMagic, and I can re-use the same code to make SplineBend 2 or something. And I'll appreciate if you could mention the features you like in SplineBend so I don't miss them in SB2.

    EDIT: I can share the code on GitLab in case someone needs it (for free of course).
     
    PolyMad likes this.
  48. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Always a good idea, you could make some buck, people could use a good tool.
     
  49. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,266
    Happy to hear it might make a return!

    What I appreciate about SplineBend is that it tiles a mesh along a spline, but does so in a procedural manner. All of the spline mesh tools I've tried (on the cheaper side) simply instantiate an object along the spline path, resulting in hundreds of separate objects, which is far from efficient.

    The fancier packages miss the mark for me, since they often provide far more than I need. SplineBend was just two scripts and just did one thing, and did it well. I always used it to make fences or guard rails, which is what I'm in dire need of right now :p
     
    protopop likes this.
  50. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I still use SplineBend a lot! its so simple and flexible, and it helps me make rivers in my games:



    I think someone made a C# version of the code on GitHub at https://github.com/zouhunter/unity-spline-bend-module

    I was going to make a conversion using CSharpatron (an amazing JS to CS converter - it saved my life) but this github version looks legit, i havent tested it yet though.

    I Use MapMagic a lot too and love it btw. I cant wait to try MapMagic 2.