Search Unity

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

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

  1. Lostrick

    Lostrick

    Joined:
    Jan 9, 2014
    Posts:
    32
    hey this is pretty cool
    but i have a problem, I tried to scale my whole model and now everything is a mess

    Before


    After

    any fix on this?
     

    Attached Files:

  2. mcsentul

    mcsentul

    Joined:
    Jun 23, 2015
    Posts:
    1
    Hy TheRealBanbury.your tutorial is interesting. and now i have a project to create 2D skeleton based animation and contrloled by kinect.. im import SprteAndBones to my project but when its controled with kinect its not seem good...in kinect im control 20 IK with 20 kinect coordinates but the character body is irregular.. i try with hinge joint in each char body joint. buts seem not working.
    i want to control 2D character with kinect like 3D char..
    mesh spite looks good but im not try it yet.
    sorry bad english.
     
  3. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Just because its a new page, and a link hasn't been posted - I'd like to direct everybody to the latest release of @playemgames version of this project:

    https://github.com/playemgames/UnitySpritesAndBones/tree/master

    It has many features and fixes not available in the older versions, so please use that first, and if that doesn't fix problems your having, then bring questions here!

    ___________________________

    And also...

    I tested out the IK (which I suppose is based on simple CCD) that is built into sprites and bones again, and found that I still can't get those angle limits to do anything :/

    I dunno if I am doing it wrong but I tried having the lower leg be where the IK was, with chain length of 2 to have the upper leg as well... I set angle limits to all sorts of stuff both on the upper and lower leg itself... and nothing seemed to limit anything.

    I also tried using the upper leg as the IK part (where the script was) and set the angle limits and targeting from there, but it seems the script/component won't work from that end of the IK chain...

    So just to repost for anyone interested, the only way I was able to get IK limiting working was with this:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3.  
    4. [ExecuteInEditMode]
    5. public class SimpleCCD : MonoBehaviour
    6. {
    7.     public int iterations = 5;
    8.  
    9.     [Range(0.01f, 1)]
    10.     public float damping = 1;
    11.  
    12.     public Transform target;
    13.     public Transform endTransform;
    14.  
    15.     public Node[] angleLimits = new Node[0];
    16.  
    17.     Dictionary<Transform, Node> nodeCache;
    18.     [System.Serializable]
    19.     public class Node
    20.     {
    21.         public Transform Transform;
    22.         public float min;
    23.         public float max;
    24.     }
    25.  
    26.     void OnValidate()
    27.     {
    28.         // min & max has to be between 0 ... 360
    29.         foreach (var node in angleLimits)
    30.         {
    31.             node.min = Mathf.Clamp (node.min, 0, 360);
    32.             node.max = Mathf.Clamp (node.max, 0, 360);
    33.         }
    34.     }
    35.  
    36.     void Start()
    37.     {
    38.         // Cache optimization
    39.         nodeCache = new Dictionary<Transform, Node>(angleLimits.Length);
    40.         foreach (var node in angleLimits)
    41.             if (!nodeCache.ContainsKey(node.Transform))
    42.                 nodeCache.Add(node.Transform, node);
    43.     }
    44.  
    45.     void LateUpdate()
    46.     {
    47.         if (!Application.isPlaying)
    48.             Start();
    49.  
    50.         if (target == null || endTransform == null)
    51.             return;
    52.  
    53.         int i = 0;
    54.  
    55.         while (i < iterations)
    56.         {
    57.             CalculateIK ();
    58.             i++;
    59.         }
    60.  
    61.         endTransform.rotation = target.rotation;
    62.     }
    63.  
    64.     void CalculateIK()
    65.     {
    66.         Transform node = endTransform.parent;
    67.  
    68.         while (true)
    69.         {
    70.             RotateTowardsTarget (node);
    71.  
    72.             if (node == transform)
    73.                 break;
    74.  
    75.             node = node.parent;
    76.         }
    77.     }
    78.  
    79.     void RotateTowardsTarget(Transform transform)
    80.     {
    81.         Vector2 toTarget = target.position - transform.position;
    82.         Vector2 toEnd = endTransform.position - transform.position;
    83.  
    84.         // Calculate how much we should rotate to get to the target
    85.         float angle = SignedAngle(toEnd, toTarget);
    86.  
    87.         // Flip sign if character is turned around
    88.         angle *= Mathf.Sign(transform.root.localScale.x);
    89.  
    90.         // "Slows" down the IK solving
    91.         angle *= damping;
    92.  
    93.         // Wanted angle for rotation
    94.         angle = -(angle - transform.eulerAngles.z);
    95.  
    96.         // Take care of angle limits
    97.         if (nodeCache != null && nodeCache.ContainsKey(transform))
    98.         {
    99.             // Clamp angle in local space
    100.             var node = nodeCache[transform];
    101.             float parentRotation = transform.parent ? transform.parent.eulerAngles.z : 0;
    102.             angle -= parentRotation;
    103.             angle = ClampAngle(angle, node.min, node.max);
    104.             angle += parentRotation;
    105.         }
    106.  
    107.         transform.rotation = Quaternion.Euler(0, 0, angle);
    108.     }
    109.  
    110.     public static float SignedAngle (Vector3 a, Vector3 b)
    111.     {
    112.         float angle = Vector3.Angle (a, b);
    113.         float sign = Mathf.Sign (Vector3.Dot (Vector3.back, Vector3.Cross (a, b)));
    114.  
    115.         return angle * sign;
    116.     }
    117.  
    118.     float ClampAngle (float angle, float min, float max)
    119.     {
    120.         angle = Mathf.Abs((angle % 360) + 360) % 360;
    121.         return Mathf.Clamp(angle, min, max);
    122.     }
    123. }
    124.  

    And this in a folder called "Editor" in your assets:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. [InitializeOnLoad]
    5. public class SimpleCCDEditor
    6. {
    7.     static SimpleCCDEditor ()
    8.     {
    9.         SceneView.onSceneGUIDelegate += OnScene;
    10.     }
    11.  
    12.     // Scales scene view gizmo, feel free to change ;)
    13.     const float gizmoSize = 0.5f;
    14.  
    15.     static void OnScene(SceneView sceneview)
    16.     {
    17.         var targets = GameObject.FindObjectsOfType<SimpleCCD>();
    18.  
    19.         foreach (var target in targets)
    20.         {
    21.             foreach (var node in target.angleLimits)
    22.             {
    23.                 if (node.Transform == null)
    24.                     continue;
    25.  
    26.                 Transform transform = node.Transform;
    27.                 Vector3 position = transform.position;
    28.  
    29.                 float handleSize = HandleUtility.GetHandleSize(position);
    30.                 float discSize = handleSize * gizmoSize;
    31.  
    32.  
    33.                 float parentRotation = transform.parent ? transform.parent.eulerAngles.z : 0;
    34.                 Vector3 min = Quaternion.Euler(0, 0, node.min + parentRotation)*Vector3.down;
    35.                 Vector3 max = Quaternion.Euler(0, 0, node.max + parentRotation)*Vector3.down;
    36.  
    37.                 Handles.color = new Color(0, 1, 0, 0.1f);
    38.                 Handles.DrawWireDisc(position, Vector3.back, discSize);
    39.                 Handles.DrawSolidArc(position, Vector3.forward, min, node.max - node.min, discSize);
    40.  
    41.                 Handles.color = Color.green;
    42.                 Handles.DrawLine(position, position + min * discSize);
    43.                 Handles.DrawLine(position, position + max*discSize);
    44.  
    45.                 Vector3 toChild = FindChildNode(transform, target.endTransform).position - position;
    46.                 Handles.DrawLine(position, position + toChild);
    47.             }
    48.         }
    49.     }
    50.  
    51.     static Transform FindChildNode (Transform parent, Transform endTransform)
    52.     {
    53.         if (endTransform.parent != null && endTransform.parent != parent)
    54.             return FindChildNode(parent, endTransform.parent); ;
    55.  
    56.         return endTransform;
    57.     }
    58. }
    59.  

    Why does this just work? I don't totally know... where did things get lost in the one included with the latest branch... I dunno!

    With this one I stick it right on the upper leg or upper arm or whatever... and it lets me set angle limits... and they work!

    Example of SimpleCCD:


    Or if you get real fancy you can do foot placement:
     
    Last edited: May 2, 2016
    theANMATOR2b likes this.
  4. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Angle limits work in the main branch, I'm not sure how you are setting them up in your project so I cannot see where you are going wrong with the set up.

    upload_2016-5-2_7-57-56.png

    AngleLimits.gif

    Same goes for others having issues, without seeing a sample project I have a very hard time seeing what could be the issue, and unfortunately my time is very limited these days.
     
  5. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Well, I'm probably doing it wrong, because I'm used to the way it works in that script. I might take another shot at it soon and if I can't get it working, I'll at least put together an example of how I did it, so somebody can point out where I'm screwing up :p
     
  6. dreamyRobot

    dreamyRobot

    Joined:
    May 5, 2016
    Posts:
    8
    Looks awesome !
    I've imported the package for unity5 here.
    But I've got some issues like this :
    Polygon.cs(46,22): error CS0101: The namespace `Poly2Tri' already contains a definition for `Polygon'
    Any ideas ? Thanks in advance !
     
  7. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    hi all,

    this is an amazing tool, although i am unable to use it as of now but i can see it as a better tools to other existing ones, not to mention the word "FREE"

    I do have a question though, is this tool capable of the bone mesh control like the Spine2d video below?



    Oh and anyone can also recommend a recording thingy that converts to gif so that I can post a smaple here also :) and our blog
     
    Last edited: May 6, 2016
  8. dreamyRobot

    dreamyRobot

    Joined:
    May 5, 2016
    Posts:
    8
    Same error CS0101 with the master branch and the unstable branch, on GitHub.

    I saw the same issue on the Banbury's Blög, on april, the 17th :

    @vignesh I am getting an error stating “Assets/SpritesAndBones/Scripts/Utils/Triangulator.cs(9,21): error CS0101: The namespace `global::’ already contains a definition for `Triangulator’”.
    Any Idea for where that comes from?

    Is anyone who works with Sprite and Bones with Unity 5 can explain how to install it ? Thanks in advance !
     
    Nateply likes this.
  9. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    @RINQUIN - Perhaps your project has an existing script using a definition called triangulator? Or whichever script it complains about...
     
  10. bingheliefeng

    bingheliefeng

    Joined:
    May 8, 2014
    Posts:
    12
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. [InitializeOnLoad]
    5. public class HelperEditor {
    6.  
    7.     static HelperEditor()
    8.     {
    9.         SceneView.onSceneGUIDelegate += OnScene;
    10.     }
    11.  
    12.     static void OnScene(SceneView sceneview)
    13.     {
    14.         var targets = GameObject.FindObjectsOfType<Helper>();
    15.  
    16.         foreach (var target in targets)
    17.         {
    18.             Skeleton sk = target.GetComponentInParent<Skeleton>();
    19.             if(sk && !sk.editMode)
    20.                 target.transform.position = Handles.FreeMoveHandle(target.transform.position,Quaternion.identity,2f,Vector3.zero,Handles.ArrowCap);
    21.         }
    22.     }
    23. }
    24.  
     
  11. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    @bingheliefeng what's this?

    EDIT: oh wait, is this a editor version of the IK control for sprites and bones? @playemgames does sprites and bones IK not run at edit-time? That could have been why I was seeing no results...

    I am confused :p - now that I have had my coffee I still don't get it haha
     
    Last edited: May 7, 2016
  12. 3CIngenious

    3CIngenious

    Joined:
    Jul 22, 2015
    Posts:
    32
    Can a mesh or skin2d be combined into 2 bones?like what @JhitoStudio asked?
     
  13. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    wohooo someone has to stop me with this, this is so amazing, so I have tried doing this and i got some animation and some weapon getting ready animation thingy, but i was wonderin what I am dooing wrong, in the edit mode when i play the animation, it looks ok but when hit play in unity the left arm flickers :( seems like it does not adapting with the IK angle thingy?



     
  14. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    @JhitoStudio could I ask you if your using the built in IK or the simple CCD one I posted above?
     
  15. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    Thanks for the quick response @MD_Reptile, i am using the build in IK with the angle elements thingy, hxnt tried to redo the anim yet
     
  16. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I have had a similar issue where I needed to take sprites completely off the gameobject for all the bones, make sure their rotations are right in world space, then put them back as children of the bones, but it seems like your using a skinned mesh, so that doesn't apply I don't think. You'll probably have to experiment around to get to the bottom of it.

    Edit: oh might it have anything to do with having edit mode enabled? Perhaps try toggling it and see if any difference is made? Just a shot in the dark...
     
  17. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    There really isn't a difference. The IK system in this is pretty much a cut and paste job from simple CCD. They even use the same dictionary for joint angles, so you have to refresh Unity's serialization (just entering and exiting play mode will do) to see any changes.

    A third of my complaints with just the IK are because of that dictionary, while another third are because of the default iteration count being 20. If you were dealing with IK chains with 30 bones in it, these "optimizations" would start to have some value, but for any humanoid, these are just wasting cycles that actually make things worse.
     
  18. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Yep, but you are welcome to improve upon it any time and submit a patch. I'll look at it and merge it if it works.

    I'm maintaining this at my own leisure right now since my time is very limited. I am considering recoding it and continue it as an open source project but with paid support so I can make the time to do support requests easier. Otherwise, it is what it is until I find the time to improve on it.

    It runs at edit time, but you need to have edit mode unchecked.
    It looks like the rotation bug I submitted to Unity here:
    https://fogbugz.unity3d.com/default.asp?792756_6j97qsgbqn3eabeh

    I have had trouble with certain curves not rotating properly on play and it is not related to Sprites and Bones.
    Yes with Weightpainter, you can manually paint the weights for each vertex.
    Yes it can, but you have to create your own meshes with the MeshCreator tool or default Skin2D creation. Also control point handling is changing from using transforms in the latest update. I will be removing transforms as control points soon as it is less efficient than using Vector3 points if you have a lot of control points.

    Most likely a conflict but without an example project about the problem my hands are tied. Make sure you are using the latest version here:

    https://github.com/playemgames/UnitySpritesAndBones
     
    Last edited: May 10, 2016
  19. dcyric

    dcyric

    Joined:
    Feb 2, 2015
    Posts:
    13
    First and foremost, great tool!

    I ran into a problem when I try to have multiple bones affecting 1 Skin 2D mesh. I have a parent bone, and added my sprite and converting to a Skin 2D object. I see all the control points but I am clueless how can I add more bones that influences the same mesh.

    I saw the tutorial but it seems they are outdated for this topic. Appreciate if someone can advise what I am missing in the setups.

    upload_2016-5-10_15-58-34.png

    upload_2016-5-10_16-1-13.png
     
  20. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    You need to use Weight Painter and paint the vertices to the bone or bone influence and recalculate bone weights.
     
  21. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    *** Just posted a poll here to see which direction I should continue with Sprites and Bones ***

    http://forum.unity3d.com/threads/po...etal-animation-tool-with-paid-support.403456/

    If I see enough support for the measure then I will spend time recoding it this summer into something more maintainable and it will remain free and open source, but I will take paid support requests to expedite it to those that really need it. Otherwise I'll just keep working on it when and where I can and supporting when I can.
     
    Last edited: May 10, 2016
    MD_Reptile likes this.
  22. dcyric

    dcyric

    Joined:
    Feb 2, 2015
    Posts:
    13
    Hey Playemgames, thanks for the advice, I had tried setting Influence Tail and Influence Head to the parent of the Skin2d, Bone_arm_L1, and its child bones, but doesn't seems to work.

    When I try to start weight painting, it goes "SkinnedMeshRenderer not assigned to any bones, Recalculate Bone Weights.

    I am wondering if I missed a setting somewhere?

    upload_2016-5-10_16-26-59.png
     
  23. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Make sure that lock bone weights is unchecked on Skin2D, then press Recalculate the Bone Weights on the Skin2D or the Skeleton component.

    If that doesn't work then zip a project for me to look at and I'll see what the issue is.
     
  24. dcyric

    dcyric

    Joined:
    Feb 2, 2015
    Posts:
    13
    Hi PlayemGames,

    I gave it another few tries following your instructions but still getting no where D:

    Thanks in advance for helping, here's the link to my project:
    https://www.dropbox.com/s/ghp6qikc1iwaoxk/Animation Test.zip?dl=0
     
  25. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    wow what a great support with this community hats of to you specially sir @playemgames (and yes I agree with your paid support you deserve it oh and yes I voted already :) ) will give that a try and will update this, about my IK animation problem, i solved it by redoing the whole animationbut in a short span of time it went then again, hopefully this can be fix, I will try your weight painter thingy :) Thanks again

     
  26. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I think besides payed support, you and the others who have contributed (TheRealBanbury, playemgames and others?) should even open a little PayPal donate thing to split amongst yerselves. I think you've worked hard to make something really worthwhile.

    I've bought assets way less functional :p
     
  27. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Sorry for the late reply been at the Sony PS4 Dev Con here in Hollywood past couple of days and playing catch up with projects.

    OK after looking at your project, you have several things going on, so I'll start off first with you want to parent the skin to the bone you want to move. If there are multiple bones for one skin you have to weight the vertices to each bone. I'm PMing you an animated gif on how you can solve the problem but it will need finessing with the weight painting to get it right.

    Thanks for the vote and the compliments! Yeah I do believe that is the bug I reported, hopefully it will be solved soon. It has been plaguing me since 5.3 and is in the 5.4 beta as well. Very very finnicky! I love the animation by the way, I have characters with butterfly knives in my game as well!

    I know Banbury already said he doesn't want to deal with the taxes, but for me it is not an issue since I own my own business anyway. Basically in order to keep it free, and open source, I'll only be accepting monies for support services, not the actual code. This tool will become something else from Sprite and Bones with a new name, and will have a lot more maintainable code base. Of course having a donation pool would be nice, but then we would have to figure out who gets what and what percentage, it could get nasty that way. Also if you look from the logs, I've been the only one really contributing these past 2 years, Banbury hasn't touched it in a long time, and now most of the code is written or re-written myself. I won't put it on Asset Store or anything, and I don't want money for my code, just for my time in helping others to use it with their projects. I'm too busy these days to make it a full product, but I would like to help others as much as I can when I can, so I will still help out when I can for free on my own time.

    Basically I'll probably have a fee for a support charge that needs to be expedited, or one could also buy a copy of my game and that would make me happy :) After the poll has ended I'll see where it lies and see what I'll do next.
     
  28. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    thanks @playemgames i do have another question though before you start your paid support :) everytime I add new mesh the other meshes that I have created with animation already disappeared? Also can i have the gif that you pinged to @dcyric u think i am having the same scenario
     
    Last edited: May 13, 2016
  29. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    You can lock the bone weights on the meshes you have already skinned using the checkbox on Skin2D. Are you saving the prefabs after skinning? I'll PM the gif to you, I'd post it here but for some reason it won't upload to this forum.
     
  30. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    I see now i know whats missing, i think i missed the part were in i make it a prefab, thanks a lot @playemgames

    EDIT: ok i think ther is something wrong with my version aparently i redownload the 1.2.2 and do the same process, import sprite, slice it, skin2d but this time when i choose the weight painter I did not receive the error and i can choose bones to paint however i got some errors, so maybe my new question is how can i download and use the current version? like properly install it in my unity?
     
    Last edited: May 13, 2016
  31. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Make sure you are using this version:

    https://github.com/playemgames/UnitySpritesAndBones

    This is the main reason why I am going to start my own tool for this, everyone keeps downloading the older version of the tool and I have no control over this forum.
     
    JhitoStudio likes this.
  32. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    so sory about this @playemgames but I am really unable to go to the correct way, i downlaoded the your version, then follow instruction of the gif but i have no luck in getting the weight painter :( i still have the error: skinnedmeshrenderer not assigned to any bones, recalculate bone weights
     
  33. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Bringing the solution here to light from our PM, you always need unique bone names, otherwise recalculating weights will not properly weight the bones to the SkinnedMeshRenderer. So if you have a several bones named "Bone" in your hierarchy, weighting the bones will fail.
     
  34. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    One more note, I am getting rid of the transform control points, they will be done by Vector3's now so you can safely delete the control point transforms if you want to using the button "Replace Control Points" on the Skeleton Component. If you have animations done with the control point transforms you can convert them with the Animation Replace Control Points tool under Window and replace the control points with the new Vector3 system in the clips you select.

    If and when I do my own version the old system will be gone but I'll still leave in the tools to convert if you want to upgrade.
    There is a performance gain if you use the new system, especially on mobile.
     
  35. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    amazing, it worked, my skinned2dmesh are recognized already, but i am unable to paint it with the error:nullreference

     
  36. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Ignore that error, it will weight paint correctly, if it is already red then the vertices are painted to that bone. Try doing Subtract and paint the vertices you do not want weighted to that bone and see what happens. Everything in that screenshot looks correct to me :)
     
    JhitoStudio likes this.
  37. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    Excellent your the best man will chek on that and post it and maybe try to record a video tutorial on this meah weight painter, anyone can suggest whats a good video screen recorder in making a tutorial?

    UPdate:
    yup you are the master of this tool, it works like a charm, jsut tell me if your in KL so we can have a bucket of beer or two thanks a lot @playemgames

     
    Last edited: May 15, 2016
  38. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    I'll take you up on that beer whenever I'm there! Glad I can help, a good capture program that I use is either VLC, OBS, or Nvidias Shadow Play. Those have some decent results if you like working with free software.
     
  39. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    hey its been a while, got so busy at work :( heres some progress of my animation

     
  40. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Great Work @JhitoStudio !

    Some news on the Sprites and Bones front. I will be making one or two more updates to the Sprites and Bones Github then I will be converting it to my own tool and will remain free and open source with paid priority support. There will still be free forum support, but it will be at my leisure. Your existing projects should work with the new tool, as I will be using most everything in Sprites and Bones for the new tool but cleaning it up and making things more manageable and efficient. I will try to include any conversion tools for anything major, like the old transform control point system is going away in favor of the vertex control points. There is a button you can push in the Skeleton component to convert the existing points, and a tool under Window/Replace Control Points that will convert the control points in selected animation clips to convert to the new system. I will be putting the new tool announced in another thread which I will post here when ready.

    It seems like everyone is on board for this change, as it can only push it forward. I will rarely visit this thread after that, and support for Sprites and Bones on my end will cease, so the name will change but the tool will live on in another form. I am also looking into the new tool being able to export to a data format so it can be used outside of Unity, so we may see animations made in Unity be used in other tools like Dragon Bones.

    Thanks for all the support so far, I'll let you all know when the final commits from me for Unity Sprites and Bones are in, and when the new tool will be up for grabs to replace it with. Take care in the meantime, and happy animating!
     
    dcyric, Avard, JhitoStudio and 2 others like this.
  41. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    this is amazing, looking forward to this
     
  42. Syrul

    Syrul

    Joined:
    Jan 15, 2013
    Posts:
    5
    Hi,

    Not sure what I am doing wrong but am also unable to use the WeightPainting tool.
    I have a moustache which is Skinned2D and attached a single Bone to it named 'BoneMoustache'.
    It is assigned to the RootBone of that MeshSkinnedRenderer but for some reason when I use the tool I still receive this message.

    Please let me know what I am doing wrong..

    Thanks.
     

    Attached Files:

  43. dcyric

    dcyric

    Joined:
    Feb 2, 2015
    Posts:
    13
    Try hitting the play button once, use the tool in play mode, stop and go back to edit mode.
     
  44. JhitoStudio

    JhitoStudio

    Joined:
    May 5, 2016
    Posts:
    17
    Hi @dcyric I think you need to make your mustache skinned2d to the bone so the correct order should be BoneMoustache>TestMoustache
     
  45. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    It needs to be a child of the Skeleton.
     
  46. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    @playemgames
    I would really love to be able to both export and import Dragon Bone animations, so this news is really great to hear!

    The one thing I've found difficult to understand with Sprites and Bones so far is being able to modify the meshes into your own custom meshes and animate the control points inside the mesh, similar to what Spine does here with the nose:

    http://esotericsoftware.com/spine-meshes#Edges


    That, and the section to make 3d-looking deformation, such as this:

    http://esotericsoftware.com/spine-meshes#Deformation


    This is really common cutout-animation stuff, so to be able to do this with your new tool would be priority imo, as an animator. Would it be possible to focus on this sort of stuff with a lite tutorial showing how to achieve this when you release your new tool?
     
  47. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    It can do all this already, you just have to make your own meshes using the Mesh Creator tool, or in a 3rd party tool.

    I'm working on making control points a bit easier to use right now actually.

    No word on tutorials yet, it may be a while.
     
  48. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    @playemgames
    That's really great to hear you're working on the control point system!

    I hate to ask for more, but would it be possible to make simulating 2d frame-based animations a lot more simple with your new system?

    For example, I was thinking that you could select some animation clips, click on a File/Edit/Etc. menu option, and set all the curves for all keyframes in each of the selected clips for position/rotation/sprite-changing/control-point-animation for each frame to be linear so it would finally be easy to simulate a hand-drawn animation with no smoothing going on between frames, while still retaining the ability to modify the mesh control points per frame (to simulate potentially very different-looking drawings) while also saving memory with cut-out parts that only have to be changed on very dramatic changes in angles.

    Bottom line is -- if your character has his arm above his head weilding a sword in the first frame, and in the second frame, it has completed the sword slice, there should be no motion or interpolation in between -- this should simulate two very separate drawing, leaving all else between the two frames to timing and the imagination. Unless you explicitly put a middle frame there, all you see is the first frame until the second key is reached, then display that second keyframe until the very end (or loop/stop the animation if it is the end). The key to doing this is likely to lie in the AnimationUtilities class, which lets you modify the actual animation clip directly while working in-editor.

    The editor menu-item could run a script that inserts an Animation Event on the first frame of the selected group of clips which contains a script to take over the animation playback of the clips (at runtime) into the beginning of each clip selected in the editor. That animation event at the start of the clip would then take control of the playback for the currently-playing animation (at runtime) from the script attached to the Animation Event on the first frame. The target clip's curve properties for each key can be set using further Animation Events that break up the curve between each animation keyframe that needs some (limited) interpolation (read: stair-stepped interpolation) events on specific keyframes, for example, when needing a sword to rotate and move across the screen semi-smoothly without having to manually place every single frame of movement (after calculating the number of rotations, etc.) you need to get it to do so. By default, the number of stair-steps between individual keyframes is 0, which is a big, long, flat line, followed by an instant peak to max frame display at the very end of the curve. 1, of course, would be right in the middle of the curve the new frame would appear at half its rotation/color/etc with a square in the middle about halfway up, and 2 would actually look like a stair-step 'curve' consisting of almost 2 steps. The argument in the Animation Event the user would set would be the number of steps (integer) that the current key will need between this frame and the next.

    Hope this all makes sense!

    It just seems like this would fit really well into this system as a compliment to allow full-control over your 2d part-based animations while still giving you all the optimizations this type of animation allows -- and component-based traditional looking animation is something that Unity, for some reason, has forgotten about.

    That said, I'd be willing to do some tutorials for this whole thing if you were willing to implement something like this! I'd love to help out getting this system to where it deserves to be!
     
  49. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    438
    Short answer is no, the long answer is Unity's animation window already does all this, just change your rotations to Euler and use constant keys for rotations and positions. If you know how to implement such a thing you could create a fork and try to code it yourself, but all the items you described here already exist in the animation window already. You just need to configure some things yourself. The aim of this project is to make skeletal 2D animation possible in Unity not rewrite the animation system. I would love it if Unity would open source their animation window API so we can fix it or upgrade it when necessary as I have had some issues during the beta phase that hindered my work considerably. You are always welcome to contribute, but I wouldn't rely on me for these features in the tool at the moment.
     
    theANMATOR2b likes this.
  50. dcyric

    dcyric

    Joined:
    Feb 2, 2015
    Posts:
    13
    A question for exporting to mobile. I tried building for an Android device and discover that the weight painting related animations does not register but it works perfectly when I build standalones, like exe for windows. Is there anything I need to take note to make it work for mobiles?