Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

RageSpline - Create smooth 2D graphics inside Unity Editor - RELEASED

Discussion in 'Assets and Asset Store' started by keely, Apr 23, 2011.

  1. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    The camera is orthographic.
     
  2. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Ok party people. Everyone using RageSpline or interested in the future of the tool should read this:

    http://juhakiili.com/ragespline/plan/.

    It's rather long, but a lot of thought went into it, so be patient.
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @keely, good honest .plan. One thing in there that is missing (and an important one IMO) is a toggle to make the border inside the shape instead of outside. Once texture support exists for the border it will make more sense.
     
  4. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'll add it
     
  5. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm now aware what is causing this and it's not fixable with some quick hotfix atm. It needs a more broader adjusting and I hope it's not causing too much trouble like it is?
     
  6. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    very interesting plan...
    Please, don't forget (really) random blob (textured and untextured !).

    6R
     
  7. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    A futuristic RageCar : from RageSpline to RageLine !!!



    6R
     
  8. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Argh, totally forgot the great randomness idea. I will add it.
     
  9. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Perfect !!! Thanks...

    My design RageBike :



    6R
     
  10. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Both awesome, but II like the blue one more.
     
  11. WebWolfRussian

    WebWolfRussian

    Joined:
    Feb 5, 2010
    Posts:
    123
    wow awesome!!
     
  12. zsogaby

    zsogaby

    Joined:
    May 2, 2011
    Posts:
    1
    It is a great extension, but I get a "Please wait" message instead of buy or download.
    What can I do?
     
  13. thomasnat1

    thomasnat1

    Joined:
    May 2, 2011
    Posts:
    3
    I am in dire need of some scripting references. I need to know how I can pull specific points of shapes back, kinda like rageCube. I can't find anything what so ever online. Any example code or any form of a library would be much appreciated.
     
  14. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Things at that department are lacking and I'm very sorry about that. Here is a link to the .plan -file explaining the current situation and my future plans for RageSpline that are going to improve your situation: http://juhakiili.com/ragespline/plan/

    In the meanwhile you can study something I posted to the forums before the launch of the tool: link

    I know it's not much, but Like I describe in the .plan file, I'm working hard to fix this.
     
    Last edited: May 2, 2011
  15. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    It's not a RageSpline related problem. Have you tried to contact the Asset Store support?
     
  16. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Thanks WebWolfRussian and keely...
    I wanted so light as possible graphics but it's my big problem : I add details and details and details !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    And I have thought about this : light forms instead of shapes or from the shapes !!!

    @zsogaby : Don't worry about this. Simply click on the home icon and go back to the asset store page of RageSpline. It should work with the download button !?!

    6R
     
  17. thomasnat1

    thomasnat1

    Joined:
    May 2, 2011
    Posts:
    3
    I really appreciate you attention and help in this matter. I recognize that you have been amazingly helpful on all these forum questions and I am really amazed by that. :)

    I saw your great game of rageCube and it seems that it does much of what I need. I obviously wouldn't ask you to release any of your game to the public but if you could tell me the tiny bit of code that you use to drag one of vertexes right before having it jump up.

    your help is really appreciated. :)
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @thomasnat1,

    - just grab the specific vert you are looking for from the Mesh: mesh.vertices and store it's original location
    - modify the vert as the users finger slides around being sure to reset it after each positional adjustment (or if you want to get a bit fancier modify some surrounding verts as well to get things looking exactly the way you want it to)
    - animate it back to it's original location
     
  19. Nekoyoubi

    Nekoyoubi

    Joined:
    May 2, 2011
    Posts:
    16
    I typed up a much longer post that I then lost, so I'm not going to do that again. Here's the short version...

    I saw RageSpline and was inspired to write a 2D game that I am now thinking of redesigning away from RageSpline 2D because a.) I'm very new to 2D development in Unity, and b.) because the only 2D I've done in Unity was done with the Z axis mapping to [ --> ], so most of the Unity built-in methods for physics (e.g. add force) or just basic 3D (e.g. look at) worked very easily out of the box.

    With RageSpline remapping the 3D space to X axis being [ <-- ] things are getting very confusing for my wee tiny brain, and I'm wondering if there is some way that I can make RageSpline work with that modified axis mapping that's more friendly, or is there a way that I can remap the objects after they're drawn to accommodate the other layout?

    Thanks much in advance for any and all help on this.
     
  20. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    It's funny how just 15 minutes ago I was talking to my friend John at Facebook, who will be doing the instructional videos. He was getting familiar with the RageSpline for the first time and there were some weird problems.

    All of a sudden I realized that I have been always using the "back"-view in editor. When you use the "back" as your view, you get what I consider normal math: X is groving to right, Y is groving to up and Z is growing away from the camera.

    You can select back-view if you right-click the xyz-axis-thingie in the top-right corner of your scene view and select "back". I also recommend unchecking the "perspective" in the same menu, but it's not mandatory.

    cliffnotes to everyone: ALWAYS USE BACK-VIEW!
     
  21. Nekoyoubi

    Nekoyoubi

    Joined:
    May 2, 2011
    Posts:
    16
    I too, am using the Back view, as that seems to be the only one I get the RageSpline controls in. This is where my question stems from. How can I undo this? How can I make Z become [ --> ], as that simplifies many of Unity's built-in functions?

    Well, let me clarify. I don't care whether I need to draw them in Back view or not. If I need to realign them somehow, I'm fine with that too.
     
    Last edited: May 2, 2011
  22. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Nekoyoubi, why does having Z be (-->) make things easier? I don't get that. Seems to me @keely's choice of X (-->) and Y (up) is the standard when it comes to 2d. I just don't see what about having Z (-->) makes things easier...
     
  23. Nekoyoubi

    Nekoyoubi

    Joined:
    May 2, 2011
    Posts:
    16
    Thanks for responding, Prime31. I'm sure that's probably very logical, but because of things like Vector3.forward (for looking at the mouse, applying force, etc) Unity seems to be a bit more geared toward Z being forward.

    Again, I understand that that's the directions he made things and that he had reasons for doing it. I'm not even saying that my way is correct, better, more accepted, or whatever. I'm just wondering if there's a way that I can remap an object to be able to put Z as my 2D-forward.

    Thanks again.
     
  24. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Nekoyoubi, if that is all you are looking for than why not just make an Extension to Vector3? You can map whatever you want onto the existing Vector3 class. If you don't know what Extension methods are check out this simple tutorial video I made:

     
  25. Nekoyoubi

    Nekoyoubi

    Joined:
    May 2, 2011
    Posts:
    16
    Assuming you're referring to standard extension methods in C#, yeah, I know those pretty well. Game development is only in my off-time, the rest of the time I'm a C# developer in much more boring avenues. I just don't know what the extension you're referring to would be. The methods are already there and mapped to the Z I'm asking about. Are you suggesting that I rewrite every method to remap the axis? ;/
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Nekoyoubi, I'm not suggesting you rewrite every method, that wouldn't help. Just the ones that make sense for you specifically. I personally have no problem at all using the axis as they are (Y up and X right) but it seems to be an issue for you. Making a few extensions that make your life easier is what I am suggesting.
     
  27. Nekoyoubi

    Nekoyoubi

    Joined:
    May 2, 2011
    Posts:
    16
    So I guess, based on the previous answer from keely (that didn't actually speak to my issue), and based on your suggestion to rewrite Unity methods, that's a "no" then to my initial question of whether or not there is a way I can remap the drawn objects?

    So far all I've gotten is "use Back view" (I already do), and "write methods to replace all of the methods that give you problems" (but that was not my question, and realistically seems like a larger hammer than I'm willing to use to fit this square peg into its round hole).

    I was just hoping to get something out of this purchase is all, but I can't use it like this. Thanks for your time, though.
     
  28. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm not that afraid of ppl copying my RageCube, but it's more because the code in that project just sort of sucks as an example. Also I'm hopefully going to make the code access make a little more sense in the future and this code example right here might be deprecated.

    I can give you some pointers, but a meaningful working example has to wait. That's just how it's going to be for now.

    RageSpline object can be retrieved from a gameObject like this:
    Code (csharp):
    1.  
    2. RageSpline rageSpline = gameObject.GetComponent(typeof(RageSpline)) as RageSpline;
    3.  
    Every RageSpline object has a variable "spline":
    Code (csharp):
    1.  
    2. public RageCurve spline;
    3.  
    RageCurve-class has an array variable "points"
    Code (csharp):
    1.  
    2. public RageSplinePoint[] points;
    3.  
    RageSplinePoint-class has these variables:
    Code (csharp):
    1.  
    2. public Vector3 point, inCtrl, outCtrl;
    3.  
    So at the moment you could do things like:
    Code (csharp):
    1.  
    2. RageSpline rageSpline = gameObject.GetComponent(typeof(RageSpline)) as RageSpline;
    3. foreach (RageSplinePoint rageVertex in rageSpline.points)
    4. {
    5.     rageVertex.point += new Vector3(Random.Range(-1f,1f), Random.Range(-1f,1f), 0f);
    6. }
    7. rageSpline.RefreshMesh();
    8.  
    The above code should randomly move every control point slightly in X and Y axis and then refresh the current mesh. I wrote this from the top of my head and did not check if it actually works or even builds. Tell me if it doesn't and I'll fix it.
     
  29. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I can surely relate why you chose the axis in the way you did. As far as I know, this is one of those things that will never be "solved". Some people like to do this and some people that.

    I had to choose which 2D axis-paradigm I supported and chose the one I have been using earlier. Unfortunately, for me to support every possible paradigm out there, I'd had to complicate things in the code. I chose the simpler way and decided to just support my own paradigm.

    I'm sorry that this is not mentioned anywhere. Surely will be mentioned in the documentation in the future.

    If this makes RageSpline totally unusable to you, I think you have to ask for a refund. If there is problems with you're refund, you can try to refer to this post.
     
  30. Nekoyoubi

    Nekoyoubi

    Joined:
    May 2, 2011
    Posts:
    16
    I don't understand why no one can seem to gather that I'm not expecting this. I don't care if RageSpline covers every magical case of axis-confusion.

    All I want to know is can I do something about the objects after I draw them? Would, say, parenting them and then rotating their object do anything for me? Is there some code I can use to reorient the drawings? Anything?

    I'm not trying to complain my way into a refund. I'm really just trying to find out if there's a way that I can use what Unity has already built with this amazing drawing extension that you've created. That's all. ;(
     
  31. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I try to be too time-efficient and end up just quicky browse through a post and go "oh, he has axis-problems" and go from there. My bad.

    I think from the top of my head, you could actually do exactly what you suggest. You could parent everything (including camera) under one gameObject and then at run-time you rotate to however you see fit. Right now, I can't think of anything that would break, but Unity is a complicated sob, so who knows. Let me know if it works or not.

    edit: I would do this in such a way, that you create the root gameobject run-time too. Iterate every root-gameobject you already have in the scene and put them as it's children. This way, the hack would be imo totally transparent to your editor workflow. You might take a minor performance hit, but I guess that's very marginal.

    I was NOT suggesting that you were trying to do some kind of "dick-move" with refund. No way. I just came from an assumption that IF the axis-stuff makes this TOTALLY unusable for you, then all I can do support-wise is to kindly offer the refund option.
     
    Last edited: May 3, 2011
  32. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I didn't see this mentioned before, but I could have easily missed it, so sorry for the duplication if so, but one request I would have for the next release would be to support the "delete" key on Macs to delete control points, since the "DEL" key doesn't appear on MacBooks. MacBooks only have a "delete" key (same as the backspace). Silly, I know. That's one gripe I have with Apple, they have crippled keyboards on their notebooks, as far as I'm concerned.

    Awesome work, BTW!
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @keely, If the all powerful @Brady likes your work than you are going to be a massive success. He is the Unity "god of middleware" :) I can see the future now....

     
  34. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    The picture made me spill my coffee. Lulz :D
     
  35. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    It wasn't mentioned before. Thanks for the kind words.
     
  36. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm just going to spill my beans here in this thread. It's fun to rant about mid-development "crisis" and I love to write about my work.

    First of all, I have to confess that I'm no math wizard. I sometimes even call myself a "math disabled person", like it's some sort of injury. I see myself like one of those CEOs of big corporations, who secretly can't read or write, and just hack their way in to the top without anyone noticing.

    RageSpline is using a bézier spline curves as it's base. I'm not 100% sure, but I think that since I'm always using two control points per bézier segment, it's called something like "2nd order bézier curve". Could be wrong. Semantics, shmemantics.

    Now while the bézier-curve is quite simple and defined, the offsets aren't. Offset means that let's say you want to make an outline: You decide to make the existing curve your inner "track" and then you offset by 5 units outward and that is your outer track.

    Now what is 5 units outward?

    Can you just scale up the whole shebang? No you can't.

    Can you just go 5 units outward along your normals? No you can't.

    What the hell can you do? Well...

    According to this and this, there is no numerical solution.

    The sentence "no numerical solution" in mathematics seems to be synonymous to "hacking".

    Right now, I have a hack in RageSpline, but it sometimes sucks. Mostly with sharp corners. I have an idea how to make it a little better, but it still won't be as good as it should be.

    Prime31 made a good suggestion about the position of outline and how you could have texturing like grass, if you could play with outline offsets. Now this would require more sophisticated algorithm for spline offsets. Bad things start to happen with my hacks, when you go further away from the original spline. Just try to make very fat outlines with sharp corners and you see what I mean.

    If I've understood correctly, this is the current industry standard. Atleast commenter in the stackoverflow said that Qt uses it, so atleast it's good.

    When I start to read that paper, I feel very dizzy.

    Look at the code, now back to me, now back to the code, now back to me, I'm on a horse, riding to my dayjob. Cya.
     
    Last edited: May 4, 2011
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @keely, that math looks like so much fun! (not really) It definitely seems like a bit of a hack is the way to go. I would almost say do things exactly like you are now but then run a second pass over the border to remove overlapping/folded tris and smooth things out. Just an idea...
     
  38. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Actually MacBooks have delete keys too, just very good hidden: Fn + Backspace / Del
    But for anti-pain interest, supporting backspace directly would be a nice addition
     
  39. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Ahh, thanks, dreamora, you learn something new every day. I was thinking there had to be some kind of hacky key combo they had like that to supplement the stinginess of these keyboards, but after messing with it for a bit, gave up.
     
  40. thomasnat1

    thomasnat1

    Joined:
    May 2, 2011
    Posts:
    3
    Hey. I have been playing a lot with this and really like it but there is one thing I can't figure out.
    I want to know when someone click on one of the objects. I tried the MouseDown function but it does not work for these. Does anyone know who to detect the click?

    -Thanks
     
  41. itech

    itech

    Joined:
    Jul 28, 2010
    Posts:
    139
    Yesterday I was buy RageSpline, for now I was pleased .

    Keep up good work in the future !
     
  42. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I hate to repeat my current mantra: "in the next update", but that's how it is.

    I'm haven't actually done it yet, but I'm going to need some kind of IsPointInsideSpline()-method for my own stuff anyways, so most likely that will be exposed as part of the official RageSpline API. It could even make sense for me to extend the MeshCollider support to cover the camera facing stuff too, so that you could RayCast your mouseclicks. But like I said, these are future development.

    For now, I guess the thing you could do right now is to put one or more gameobjects with box/sphere colliders as a child of the RageSpline-object and position them so that they cover approximately the area of your spline (hopefully it's not very complex shape). Look at the RageCar-example game and how I set up the actual Car with multiple colliders. You can Raycast mouseclicks against those. Lemme know how it worked out.
     
  43. alex.loren

    alex.loren

    Joined:
    Jan 7, 2011
    Posts:
    83
    Thomasnat1, I have used the method described above by Keely, and I have had success with it thus far. So if you're needing to detect if an object is clicked, this is the way to do it so far. If you need, I can throw up some sample code of how I am doing it in my side project, let me know!
     
  44. itech

    itech

    Joined:
    Jul 28, 2010
    Posts:
    139
    My work in first night with RageSpline :
     

    Attached Files:

  45. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Nice! Maybe a little more vertices for the background hills to get the roundess. Did you do the anti aliasing-blurring on purpose?
     
  46. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    @ alex.loren : I'm very interested too in real examples and not only methods because I'm new in Unity...
    Sample codes will be very helpful !

    6R
     
  47. alex.loren

    alex.loren

    Joined:
    Jan 7, 2011
    Posts:
    83
    p6r, what sort of examples would you like to see? I would have no issues with picking a few from a list and creating working examples for the community. So if you would be willing to provide some examples of what you would like to see, I would be willing to take a stab at producing a few.
     
  48. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Ok alex.loren... You're right !!!
    For example, I would like to know how to drag (and drop) a point of a spline with the mouse, through a script, to deform a spline at runtime !?! (And drag and drop the whole spline object !)

    What is the way to access a point by a C# script ???

    6R
     
  49. alex.loren

    alex.loren

    Joined:
    Jan 7, 2011
    Posts:
    83
    I should be able to make that example and be able to provide it some time this weekend, though it may take longer depending on what my classes need of me over the next few days; but I will let you know as I progress on it.
     
  50. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Don' t worry... it's already a great thing if you can do that. I will wait for it without problem when you're ready !
    Thanks a lot.

    6R