Search Unity

[Release][Free] Unity Sprites And Bones - 2D skeleton animation

Discussion in 'Assets and Asset Store' started by TheRealBanbury, Dec 29, 2013.

  1. cpavanelli

    cpavanelli

    Joined:
    Apr 11, 2013
    Posts:
    6
    Hi guys,

    that's exactly what I was looking for, will play with it after work today.
     
  2. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    @TheValar:

    I'm in the process of merging your changes. I'm doing some fine tuning, but everything looks fine so far. All features including IK and skinned meshes seem to work as expected.
    I have just one request. If you make other changes, please use an editor that preserves line breaks. Your editor changed all line breaks, which played havoc with git.

    Many thanks for the help.
     
  3. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Whenever I saved a file MonDevelop gave me the option to "fix line endings" or something which is probably what caused the problem. I'll be mindful of such things if I make future commits.
     
  4. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    I have submitted Sprites And Bones to the Asset Store. I'm now waiting for the result of the review by Unity.

    Some notes on further development and the Git repository:
    From now on there will be two branches in the Git repository.
    * master: The stable version of the addon. If the addon is accepted in the Asset Store, this will be the latest submitted version.
    * unstable: This is the development version. Here are all the newest unreleased features and bugs. This will be linked for download at the beginning of this thread.

    @TheValar: If you want to continue developing on this addon, you will have to pull the changes from the master branch:

    git pull https://github.com/Banbury/UnitySpritesAndBones.git master

    Make sure, that you have no uncomitted changes before pulling.
     
  5. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    I'll be checking this out for my game as well. I have been looking at a few other solutions, but always nice to see something integrated in Unity! Will report findings.
     
  6. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    Thanks for your interest. Any feedback is welcome, no matter how critical.
     
  7. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    any updates on this? seriously tempted to give it a try
     
  8. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    Well, what are you waiting for? Sprites And Bones is working as advertised and I have fixed every bug, I could find or that was reported to me. I'm still working on new features and will continue so as long as I have new features. If you're missing something, that keeps you from using Sprites And Bones, tell me and I will see, what I can do about it.

    Expect a new version on the weekend.
     
  9. stereoK

    stereoK

    Joined:
    Jan 21, 2014
    Posts:
    5
    Hi, I'm a beginner to unity and just started to learn, yet I walked through the tutorials and it seems so easy! Great tool! I would be so very grateful though if you could also post a small tutorial or demo project on how to integrate a movement animation done with this tool on a player character ( like you did in the Feeble game sampled above) . Thanks ( and sorry for being so noob :) )!
     
  10. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    You can integrate these animations just like any normal animations. I'd recommend for now downloading Unity's 2d demo project. I used that as a base when i did the video you referenced.
     
  11. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    296
    I havent had a chance to try this yet as this week is slammed with other stuff, but I have to say the support here is awesome.
     
  12. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    Well then! Seems ill give this a go TODAY then! Great job on this, i own spine but its just toi advancednfor what it is...really hard to work with.
     
  13. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    Making tutorials is a lot of work. Every tutorial takes hours to make, which means less time to code new features. I have to limit myself to tutorials, that show off new features.

    On another note, I'm still waiting for any reaction of the Asset Store team. I'm not even sure, if my submission was received by them. The Asset Store Manager doesn't give me any useful feedback on that.
     
  14. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    i can vouch for that as ive started making my handpainted 2d game graphics tutorials and yeah, they take a lot of time to make. First I gotta paint stuff im not gonna use in my own games,wich takes time from the game obviously, and then I gotta edit the video.

    but keep it up, im getting this asset for sure!
     
  15. stereoK

    stereoK

    Joined:
    Jan 21, 2014
    Posts:
    5
    You are right, I'll try to start from the unity 2d demo as The Valar recommended, as for the tool no matter what asset store thinks about it I can say that we love it, since it's free and easy to use. So please , keep coding features :). I've looked a bit at the Spine demos and what I can say is that Sprites and Bones has all the features there. If I manage to make some character move I might post a small noob guide myself in here if you like.
    So thanks again!
     
  16. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    Please do!

    This is after all an open source project. The more people are working on it, the more fun it is.
     
    Last edited: Jan 22, 2014
  17. stereoK

    stereoK

    Joined:
    Jan 21, 2014
    Posts:
    5
    Ok, so I played around a bit and in the end I got this ( I'm only learning Unity for about 1 week so I guess some stuff can be done a lot better, yet for someone new this should be a starter as per how to integrate a Sprite and Bones anim in a Unity game) :

    - $steps.jpg -
    The steps:

    1. get an image ( in my case a bird), import it, set the Sprite Mode to multiple and split the image in 3 sprites ( head, body and legs) using the Unity Sprite Editor - or create a sprite package if in Unity Pro.

    2. create a skeleton as in video tutorial_1 on the first page

    3. attach the sprite images to the bones as in video tutorial_2

    4. in the Unity Animation window create some animations by moving the skeleton bones ( I've created an idle animation used when the bird is doing nothing, a walk for when you press "left/right" and a feed animation for when you press "space")

    5. in the Animator Unity window link the 3 animations the way you intend them to work ( I linked "idle" to "walk" and "idle" to "feed", as I didn't wanted to have the bird feeding while walking )

    6. create some Parameters (also in Animator window), then set the correct condition for each link between animations ( I wanted to get from "idle anim" to "walk anim" when Parameter "idle" is false, so I've set this condition on the link, also we get from "walk" to "idle" when when Param. "idle" is true, same thing goes for idle->feed anims but with feed param set true or false.)

    7.create a script to set the animation parameters depending on the user input and attach it to the main skeleton - View attachment $script.js - - when you press left/right the idle parameter from Animator is set to false and so the Animator will switch animations; same for feed when pressing space.

    8 - result : View attachment $Bird.rar

    9 - assets package for this small tutorial ( only works with the sprite and bones asset package imported): View attachment $BirdTutorial.unitypackage

    Happy Bones Animating!
     
    Last edited: Jan 23, 2014
  18. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    A very nice tutorial! Can I use it on the Github wiki? With proper credit of course.

    I'm impressed, that you figured this all out in just a week. That's no mean feat.
     
  19. stereoK

    stereoK

    Joined:
    Jan 21, 2014
    Posts:
    5
    Thanks, it's mainly the merit of the 2D demo game from Unity and some internet resources on unity animator ( also thanks to TheValar for showing me the right direction to start).
    I have created a small package with the bird tutorial resources and attached it to the previous post ( step 9) so that you can include it easier, please improve it in any way you like to :).
     
    Last edited: Jan 23, 2014
  20. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
  21. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    I've uploaded a new version, that has a tool to create meshes from sprites within Unity. These meshes can be used with the Skin2D component.

    Here's a tutorial on how to use it:

     
  22. stereoK

    stereoK

    Joined:
    Jan 21, 2014
    Posts:
    5
    Great feature I'll try it right now - this tool gets better and better each day!
    I was also wondering if it's possible to change the skin for the skeleton at some point or attach a new image to a bone ( like getting a weapon in hand ) from script or another way.. And if yes where should I start looking for info :) I suppose it has something to do with children gameobjects, each image is considered children to a bone which is children to the main skeleton?
     
    Last edited: Jan 25, 2014
  23. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    That's exactly how it works. Every gameobject can have a parent. And a bone is just a fancy gameobject. You can attach any gameobject including sprites to a bone by simply dragging and dropping it on the bone. In a script you need to set <gameobject>.transform.parent.

    This is the code to create a skeleton and attach a bone:
    Code (csharp):
    1.  
    2. GameObject o = new GameObject ("Skeleton");
    3. o.AddComponent<Skeleton> ();
    4.  
    5. GameObject b = new GameObject ("Bone");
    6. b.AddComponent<Bone> ();
    7.  
    8. b.transform.parent = o.transform;
    9.  
    Changing the skin is essentially the same. Once the skin is weighted, it should be possible to remove it from the skeleton. I haven't tried, yet. But all information about the bones and weighting is saved with the skin. Switching the skin would involve detaching the skeleton from the skin and attaching it to the new skin. The skinned mesh renderer has a property 'Root Bone' which also needs to bet set.

    I hope this helps as a starting point. If you get stuck, just ask again.
     
  24. bitbutter

    bitbutter

    Joined:
    Jul 19, 2012
    Posts:
    60
    Doing some research on 2d bone animation solutions in unity. I didn't make a choice yet but this looks very promising. In any case thanks for your work!
     
  25. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    If you do make a choice, I would like to know what influenced it. It might help me to understand how people react to Sprite And Bones.
     
  26. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Surely the interface, features and ergonomy :)
    At the present time, none of the existing tools fulfill these requirements
     
  27. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    Could you elaborate on this? If you're missing anything in special, I might be able to add it.

    I'm aware, that Sprites And Bones might not be as easy to use as other tools. Some of this is actually a conscious decision of mine. Ease of use usually comes with a loss of flexibility, because features are intentionally hidden to avoid confusion. Sprites And Bones is meant as a professional tool. So every feature is isolated in its own component. And these components have to be assembled individually by the game designer. This is more work at the beginning, but allows you to use exactly the features you want. If you don't need IK, don't add the component. Don't need skinned meshes, don't use them.

    The limitations of the user interface, are mostly the limitations of Unity. Unity doesn't offer much support for advanced user interfaces. The editor gui doesn't even have list boxes. Or global keyboard shortcuts. Or drawing functions. Or a consistent Undo system. So for the most part I chose compatibility and consistency with the existing Unity editor.

    All of the different solutions for 2D bone animation, have their strength and weaknesses. Sprites And Bones strength is, that it doesn't cost you a single dime and you get all the features you need.
     
  28. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    I'm sure you can do something "easy" to use and with a lot of choices and possibilities :) it's a matter of design choice

    I've seen some tools with advanced interfaces so I'm not sure Unity is really limited, but I'm not aware of how to do this since I'm not a dev and didn't had the time to do research

    yush, if the project is open source and some devs participate, it could be great, for sure.
    There is different solutions but at the current time, none of these permit to do something as elaborate as rayman origin or vanillaware games.
     
  29. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    I'm developing software for quite some time now. I can assure you, that ease of use and flexibility are at opposite ends of software design. The challenge is to find the right balance for your audience. For example compare Windows Paint with Adobe Photoshop. The former is the easiest way to paint digitally, and many beginners have started with it. The latter is very flexible, but has a high learning curve.

    It's a matter of resources. It's possible to do a lot in Unity, but not out of the box. It takes a lot of time and effort. I'm doing this in my spare time, so I have to compromise, again.


    Sprites And Bones is open source.
     
    theANMATOR2b likes this.
  30. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Photoshop is currently the easiest painting software used today and the most used because of its solid interface and tools :) ( though there is some inconsistencies ... )
    ( and I can say that because I've tried a LOT of softwares to do the same thing )

    Sure, you're right, but I've just replied to your question :)
     
  31. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Wow, just came upon this today. I've got to say, I own a Spine Professional license and while I love that tool - I think I'm going to have to give this a go ASAP. Spine is great as a standalone editor that can output to multiple platforms and even PNGs, but the idea of doing this all inside Unity using native Unity tools? That's a BIG plus.

    I'm a big fan of 2D Toolkit though, which hasn't been mentioned much in this thread. I'm hoping there's no showstoppers there. TheValar, sounds like you favor 2D Toolkit as well - how's it been for you? While I could use just 2dtk's camera and Unity's sprites, I'd really miss the indie-compatible sprite batching and sprite dicing.

    Going to have to give it a go and see what I find. Being Open Source, maybe Unikron Software can help with any rough edges. Between this and UMA, Open Source projects for Unity are really exploding lately. Big, big thanks TheRealBanbury.
     
    Last edited: Jan 29, 2014
  32. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    From another developer and digital artist - you have a point there. :) I'm willing to put up with a lot, I really enjoy Blender for example, but I absolutely can't bring myself to use Gimp or Inkscape over Photoshop or Illustrator.
     
  33. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    I'm pretty sure a beginner with Photoshop would disagree with you. For me it took quite some time to find my way around all those menus and tool windows and stuff. And there are still a lot of features I don't know how to use. Right now I prefer Paint.NET, not the least beacuse it starts about 10 times faster :).

    @Rirath:
    Thanks for your interest. If you like Blender, you might also like Sprites And Bones. I drew a lot of inspiration from Blender.
     
  34. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Yes I definitley favor 2dToolkit. For the demo video I made I actually used all native Unity Sprites by I experimented a bit with 2dToolkit sprites as well and they work find. At one point I actually had some 2dtk sprites and some unity sprites as part of the same skeleton. Since it's just manipulating trasnforms it shouldn't matter.

    NOTE: I can't speak for the mesh deformation because I honestly haven't needed this feature yet.
     
  35. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    I wish I could use illustrator and photoshop but it's too expensive for me to justify purchasing it :( I'm not sure that they are easier to use than there free counterparts though. I feel like it mostly comes down to what you learned how to use first.

    I personally tend to use paint.net over Gimp though since my needs are generally more simplistic (I'm not really an artist).
     
  36. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    nah.
    I'm coming from corel photopaint ( you know that? :) ) then painter 6.0, which was the best painting software for me at this time.
    Then I switched to photoshop due to pro setup. I had some hard times at the beginning to paint with ( no color blending, no advanced brushes... ) but today, after tried maaaaaany other softs, I can assure you that it's is the best suited soft for any graphical job ( texturing, painting, photo comp, photo edit... )
    I mean it is not perfect for a particular kind of task, but it can do many things simpler than others ( because its interface was solid )

    Gimp is not what I call something well designed and Paint.net is not something you can use professionally.
    I don't think any of you have opened any software and knew already how to use it fully...
    and, I don't understand what the point of comparing artistic software when we're not an artist :)
     
  37. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    There was a strange flurry of interest in Sprites And Bones yesterday. Tutorial 1 got 60 views - more than 6 times the usual. And I got a bunch of stars on Github. I wonder where that came from?
     
  38. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Probably unrelated, but I recently linked it on the /r/unity3d and /r/unity2d subreddits. Honestly, this extension should be way more popular.

    Also noticed Spine is getting an interesting project that converts it's output to a more Unity native format. Maybe that's generating a bit of renewed interest in Unity + skeletal animation in general.
     
  39. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Fair enough. Not really comparing, it seems clear that adobe products are probably the clear choice for true professionals
     
  40. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    I don't want to be a spoil sport, but could you discuss the merits of Photshop somwhere else?
     
  41. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    I'm still trying to upload Sprites And Bones to the Asset Store. I'm now in contact with Support and there seems to be an issue with the Asset Store Tool. Pressing the submit button simply does nothing. We'll see how long it will take to be resolved if ever.

    Currently I'm toying with different ideas to create a better user experience. But Unity still fights me all the way. :)
     
  42. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    good luck in both endeavors!
     
  43. charlielee

    charlielee

    Joined:
    Apr 21, 2013
    Posts:
    8
    If I want to work with 3D max for IK animation, can I work with 3D Max ?
     
  44. devandart

    devandart

    Joined:
    Jun 7, 2013
    Posts:
    144
    Subscribed your thread.
    This is a really awesome project and it reminds me of ToonBoom Studio I use for 2D Skeletal animations!

    Keep up the good work. :)
     
  45. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Just saw this now, this is incredible! Open source and free sprite and bone animation editor! I'll have to look into this, I've been trying to find a good solution, but now maybe I can help contribute to this one. The mesh deformation was the killer feature I need over all the others. Can you assign points to deform across the mesh to animate over time? Thanks for your contribution!
     
    Last edited: Feb 4, 2014
  46. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    Thanks for your interest.

    Could you explain in more detail, what you want to accomplish? Currently the mesh vertices are assigned to the bones according to the latters' influence values. If you animate the bones, the mesh is deformed.
     
  47. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Kind of like this (View about 1 minute in):



    You can assign points and deform the images at those points along the mesh. The control points could be interpolated between the poses.
     
  48. TheRealBanbury

    TheRealBanbury

    Joined:
    Dec 15, 2013
    Posts:
    248
    You could create a similar effect by using bones and a skinned mesh. A very short bone is more or less a point. If you switch off parenting, bones can be moved independently from each other. No promises, but I might create a short tutorial how to do this over the weekend.
     
  49. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Would love to see how you can get this working. Basically then you can do all kinds of image manipulation and eliminate the "paper doll" look most 2D skeletal animation has.
     
  50. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Came across this thread over on the Spine forums. In it, someone is making the feature request for masking...

    I have to admit, I don't know if I fully grasp the possibilities, but that said the project's programmer agrees it'd be a great feature but says runtimes (Spine supports many engines) are the biggest limiting factor.

    Got me wondering, would masking be possible with a tool like this and Unity? If not, would it be a worthwhile feature to add to the wish-list? Just wondering aloud really, I'm frankly still astounded by the features already in Sprites and Bones and have recommended it every chance I've gotten.