Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Puppet2D - An advanced skeletal animation tool

Discussion in 'Assets and Asset Store' started by jamieniman, Dec 31, 2013.

  1. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Sometimes the triangulation can break, and when u redo it it works again. If it keeps breaking try this: open the sprite in the sprite editor and move the bounds of that sprite slightly and then try again.
    Im working on making the conversation more stable, if none of the above solves ur issue could u send me the sprite for testing (send it to puppet2d@gmail.com)
     
  2. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    287
    Had some chance to come back to this plugin. One of the advantages I see of the IK being directly tied in with Unity's animations system (as opposed to Spine / Spriter / Smooth Moves) is that you can influence the skeleton via scripting. (I'm actually not sure if you can do this with the other programs - I haven't tried - just seemed easier to do with Puppet2D).

    Anyways, here's a brief test I made:
    http://www.openmicgames.com/2DShooter/Puppet2DShootingTest.html

    Uses no animations, just the the few bones and controls, the following is done via script by manipulating the controls (Position/Rotation for the IK hand, Rotation for the Orientation Neck)- same for the recoil.

    The next step I'd like to do is get this working in conjunction with an animation - I'm not quite sure how that's possible atm, maybe some people here could help with ideas. I'm thinking that I could combine this with an idle cycle by using Mecanim layer masking (http://www.youtube.com/watch?v=d0vDP2K6wSo) so that only the legs/chest would respond to the animation track, when the gun is drawn, leaving the rest to be controlled by the aim script.
     
  3. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    Hey man great tool!

    WAs wondering how i would go about animating tiny characters that doesnt have more than one bone in their limbs? I know u need atleast 2 bones to use the IK's, is ther any way to make a bone thats not active somehow so that the bone i need gets and IK?

    I tried messing about with a few things but cant seem to get what i need. I know Spriter and Spine offers the option to place "points" instead of bones, so that u can get this effect, they basicly act as invisible bones.

    My character, like i said, only needs 1 bone in each arm and leg since he is tiny, and they need to be attached to his body.
     
  4. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    287
    I second Kelde's question :)
     
  5. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    You can make a 3 bone leg with the third bone on top of the second. Then make an IK Control on the 3rd bone. After this you can remove the spriteRendere from the second bone (not essential) Now parent your sprite to the top bone and you have what is in effect a single bone arm or leg.
    Let me know if that works for you, or if you want it to behave differently.
     
  6. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Nice stuff :) Sounds like you're on the right track with using layer masking with mechanim. Love to see it when its finished.
     
  7. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    Ok i tried that, made the limbs go all crazy:p I set his arms and legs like this, it sort of worked but they were acting like i could pull them out of their sockets. And when i moved one IK, all the other limbs were moving aswell, even tho they werent part of eachother. Can u try this urself to check if im missing something?

    Thanks alot!
    Kelde
     
  8. Kelde

    Kelde

    Joined:
    Feb 28, 2012
    Posts:
    629
    Hhehe ok nvm, it even moves when i move windows around!:D all my "cheated" IK's spin like crazy when i move anything inside unity, dont even have to touch em:p
     
  9. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Yikes - thats very odd. Could you package it up (with your version of puppet2d) and send it to me at puppet2d@gmail.com so I can take a closer look?
     
  10. stephaned

    stephaned

    Joined:
    Nov 14, 2013
    Posts:
    5
    Hi,
    When I convert the sprite to mesh, the mesh does not look the same. Anyone knows how to fix that?
    Thanks $Branch_BeforeAfter.PNG
     
  11. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Hey stephaned, I suspect your sprite pivot was not centered, is it the case?
    If yes, center it before you do the convert thing. It is something that is being corrected, maybe in the next version.
     
  12. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Yup, I have done a fix for that (last night in fact!) Email me with your invoice number and Ill send it to you. (It has quite a few extra improvements, which will soon be v1.7, but I have few things still to do before properly releasing this update)
     
  13. stephaned

    stephaned

    Joined:
    Nov 14, 2013
    Posts:
    5
    You are right, that fixes the problem, thank you very much!!!!
     
  14. Dabigne

    Dabigne

    Joined:
    Mar 13, 2014
    Posts:
    2
    Hi,

    This seems to be a really great tool.
    I would like to know if assets built with Puppet2D will work in an iOS or Android game?
    And does it require the pro version of Unity?

    Best regards and once again good job.
     
  15. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Yes, it certainly works on mobile, and it doesn't require pro :)
     
  16. Dabigne

    Dabigne

    Joined:
    Mar 13, 2014
    Posts:
    2
    Great!!
    thanks for the informations.
     
  17. Avko

    Avko

    Joined:
    Mar 29, 2013
    Posts:
    2
    Hi!
    Nice tool!
    One question
    - i have tk2d sprite (from collection), can i maybe convert this sprite to mesh?
    I have many draw call, if i use unity sprite. This is the reason why i use tk2d.
    Thanx!
     
  18. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    You can make use of tk2d sprites if you parent them to bones. (You don't need to convert them to a mesh to do this).

    If you want to make use of skin weighting, you can't directly convert a toolkit2d sprite to mesh.

    I'm guessing what you want is to make use of toolkit2d sprite atlas creation (when you create a collection).

    There is a manual way to make use of this - if you check the spriteCollectionData folder you will see an image called atlas0 or something like that. You could change that to sprite and use the sprite editor to split it up - that way you get the advantage of toolkit2ds sprite packer. The only issue with this solution is you should recommit the toolkit2d collection as it will remake this atlas!

    Hope that helps :)
     
  19. Avko

    Avko

    Joined:
    Mar 29, 2013
    Posts:
    2
    I need to use skin with multiply bones...
    If i will use sliced atlas, i will have same number draw call :)
    Do you know the different way? :)
    Thanx!
     
  20. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    If meshes have the same material and are under the Global_CTRL they will be combined into one skinnedMesh and be one drawcall.
     
  21. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Hi Everyone,

    v1.7 is now released, new features are:

    - Choice of 4 Different Sprite To Mesh Conversions
    - Improved Default Skinning (choice between 1 or 2 bone skinning)
    - Refresh Global Control Button
    - Sorting Layer Exposed on Meshes
    - Flipping characters no longer breaks with PolygonCollider2D or 3d Box Colliders
    - Custom Pivot Allowed on Spritesheet sprites
    - Other Mesh Conversion Bug Fixes

    If you'd like to know anything about the changes please let me know :)
     
  22. S37H

    S37H

    Joined:
    Apr 1, 2012
    Posts:
    22
    Awesome! Thanks for continuing to work on this. It's a great tool! :D
     
  23. Roland1234

    Roland1234

    Joined:
    Nov 21, 2012
    Posts:
    186
    Looking forward to it! Is there any documentation on the new features? I don't see anything in the .pdfs or on your site. Specifically, what does 1 or 2 bone skinning do?
     
  24. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    I've got quite a few new features and iprovements I'm developing, which is perhaps why I've not round to updating the docs yet.

    1-2 bones skinning sets how many bone influences default to each vertex. So 1 would mean each vertex only is skinned to 1 bone as a default, wheras 2 will default to 2 bones for each vertex. This is only for the default skinning - after you always modify each vertex to skin to 1-4 bones.

    Let me know how you find the 2 bone skinning :)
     
  25. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    thanx - I'm currently working on quite a few new features and improvements, and as I get them done I'll be updating the package so keep checking back here for updates :)
     
  26. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Anyone who got the recent update - I found a couple of bugs that I'm looking to fix -

    Firstly comment out the following lines in Puppet2D_CreatePolygonFromSprite.cs

    181,182, 351,352

    also
    the Puppet2D_SortingLayer is a bit buggy so its best to remove this component from the mesh until I get it fixed. (When I do Ill let everyone know)
     
    Last edited: Mar 31, 2014
  27. mhope

    mhope

    Joined:
    Aug 14, 2013
    Posts:
    13
    Hey there, motion designer here.

    First I'd like to thank you for making this tool available.The interface is considerably easy to understand, especially compared to other tools I've tried in the past. Puppet2D has been very useful through our prototyping process, so far.

    I thought I would bring to your attention a possible bug that I ran into while making a new rig.

    I was trying to test different mesh set ups to see how well I could control texture deformations, and so somewhere through the course of adding sprites, creating polygon 2d colliders, converting the assets to meshes with puppet2D, and of course "undoing" undesirable results, I ran into this error when trying to ender Edit Skin Weights mode:

    Already in edit mode, first click finish Edit SKin Weights to start again
    UnityEngine.Debug:LogWarning(Object)
    Puppet2D_Editor:EditWeights() (at Assets/Puppet2D/Scripts/Editor/Puppet2D_Editor.cs:1120)
    Puppet2D_Editor:OnGUI() (at Assets/Puppet2D/Scripts/Editor/Puppet2D_Editor.cs:188)
    UnityEditor.DockArea:OnGUI()

    After wrestling with it for a while by deleting the mesh and starting from scratch several times to no avail,
    our engineer simply suggested I restart Unity which seemed to fix the problem.

    Because it seemed to be okay after restarting Unity, I can't say that this is a bug with puppet2D,
    but I thought we'd let you know about it.

    Thanks again for the awesome tool and great support!

    -Matt
     
  28. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Thanks for letting me know about the bug - i think has to do with how I'm remembering that its currently editing the character - perhaps undoing has caused it to forget this.

    Glad you're enjoying Puppet2d :)
     
  29. Artz5

    Artz5

    Joined:
    Feb 8, 2014
    Posts:
    3
    Hi,
    has anyone else encountered problem with PolygonCollider2D with rigidbody2D?

    The collider freeze and won't flip when used with rigidbody2d but when I apply
    rigidbody2D on Global_CTRL parent object, the collider will flip but still freeze when disable/enable it

    ***Unity 4.3.4f1
    ***Puppet2D v1.7

    Video Example(**from new project**)
    http://youtu.be/EoeICMWQtV4
    [video=youtube_share;EoeICMWQtV4]http://youtu.be/EoeICMWQtV4
     
  30. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    This is actually a bug in the current Unity 2d physics. I've informed Unity and they said its on their list to fix.
     
  31. Bramlet

    Bramlet

    Joined:
    Nov 8, 2013
    Posts:
    20
    Hi, Jamieniman.
    I bought this asset recently and have some problems:
    it seems that this extension works only with tutorial file 'PuppetMan.psd', i tried to animate another images and i couldn't even attach arms to shoulders, and when i click 'convert sprite to mesh' sprites get invisible.
    Could you, please, help me.
    Thanks.
     
    Last edited: Apr 6, 2014
  32. kaykay

    kaykay

    Joined:
    Aug 1, 2012
    Posts:
    17
    Why does your example 2d model(cowboy PuppetMan) animations needs 15~18 drawcalls for just one model..???

    Is this anim model played from the only one sprite atlas?

    I can't understand why the drawcall takes so many just for drawing one character from one sprite atlas ??
     
  33. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Theres a bug in the latestest version - which I posted a temp fix for a couple of posts ago, here it is:

    The fix is going through asset review :)
     
  34. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Turn off the visibility of the bones and controls (they shouldn't be viewed in the game so they dont need to be batched).
    Now when you play the game and check the draw calls you should see the drawcalls drop to 1/2 - this is because Puppet2D combines all the meshes into 1 at the start (As long as the CombineMeshes checkbox is checked on the Global_CTRL)

    As a little explanation - skinned meshes influenced by bones do not automatically batch (They are not sprites, even though puppet2D uses the sprite texture in their material). So wehn you have multiple skinned meshes - even with the same material, they won't start off batched. The good news is, Puppet2Ds global control will combine all the meshes into 1 skinned mesh, which fixes this issue.
     
    Last edited: Apr 6, 2014
  35. Bramlet

    Bramlet

    Joined:
    Nov 8, 2013
    Posts:
    20
    Thank you, now it works like a charm :cool:
     
  36. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Hi Everyone,

    I've released an update to Puppet2D with some useful new features and fixes.

    This is what has changed:

    - Bake animation to bones button (bakes control animation onto bones as keyframes)
    - Improved Create Bone Tool, Backspace to delete, Alt click to add bones, shift to move individual bone, ctrl to move bone hierachy
    - Edit skin weights colors highlighted bones
    - Fixed Mesh Creation sprite pivot bug
    - Fixed sorting layer bug

    Heres a short video explaining how to use the new features :

    [video=youtube_share;dXD4-WS89tA]http://youtu.be/dXD4-WS89tA

    As always if you have any questions about the release, don't hesitate to get in touch :)
     
  37. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    287
    Awesome, the baking sounds like it will be a great addition to my workflow and solve some of the issues I'm having with trying to control shoulder pivots at runtime. Will check it out and let you know!
     
  38. mojao

    mojao

    Joined:
    Sep 2, 2013
    Posts:
    42
    Hello,Mr.jamieniman. Nice to meet you.
    I bought this asset. thanks for update!
    Then,i have a question, you do drag&drop sprite to scene view in the tutorial video.
    But my environment, that can't do. What should i do to drop?
    (sorry for elementary question!)
     
  39. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Make sure your sprite is set to a sprite in the inspector (Texture Type). Also be sure you click the 2D checkbox at the top of the scene view :)
     
  40. Bramlet

    Bramlet

    Joined:
    Nov 8, 2013
    Posts:
    20
    Hello, jamieniman.
    after latest update i've had a problem:
    i'm drawing some bones then i click 'right click' to start new joints, then i select one of my joints to be a parent of new joints, and when i'm trying to draw new bones something goes really wacky, so i have to join the joints manually in hierarchy.
    could you, please, help me.
     
    Last edited: Apr 10, 2014
  41. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Hi Bramlet,

    I think I know what you are referring to. Puppet2D doesn't currently display the connections between a bone and all its children. It only will show the connection to one of its children. This is a visual snag, and doesn't affect functionality.

    Whats recently changed is now when you start drawing from a bone who has a child, the bone will visualise the connection to the new bone, and remove it from the other child (before it remained at the other child). You can quickly change which bone shows the connection by using shift on the child bone u want to see connected. (Before you couldn't change this after you'd created the bones)

    Like I said - its only a visual thing, I wouldn't worry too much about it in terms of affecting your rig. Its definitely on my list to have all child bones show their connections.

    Hope that answers ur question, let me know if its something completely different ;-)
     
  42. mojao

    mojao

    Joined:
    Sep 2, 2013
    Posts:
    42
    Thanks Mr.jamieniman! I forgot to hit 2D button,sorry...
    I'll enjoy your asset !
     
  43. SeTHBeaRzz

    SeTHBeaRzz

    Joined:
    Jan 8, 2014
    Posts:
    35
    Hi,
    is there a way to utilise TK2D Sprites on Puppet2D?
    Specifically the Sprite to Mesh function.
    I can't seem to do so on default.
     
  44. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    No, currently they need to be Unity sprites to convert to mesh.

    You can make use of Toolkit2ds atlas creation - if you find it in the collectionData folder, duplicate it and turn it into a multiple unity sprite.
     
  45. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    801
    I've updated my Puppet2d plugin from v1.4 to v1.8 and now my character doesn't flip. I can see the flip bool is still there but apparently it's not working anymore. Any idea what's wrong?

    [EDIT]
    It works on edit mode, but not during runtime.
     
  46. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    How are u using the flip at runtime? Are u animating it, or are u setting it by code?
     
  47. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    801
    Just setting the flip bool by code. It worked fine on v1.4.
     
  48. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    Wow, really sorry - looks like fixing one thing has broken the flip,

    as a temporary fix open the Puppet2D_GlobalControl.cs and at the beginning of the update funtion add this line:
    Code (csharp):
    1.  
    2. transform.localScale = new Vector3(Mathf.Abs(transform.localScale.x),Mathf.Abs(transform.localScale.y),Mathf.Abs(transform.localScale.z));
    3.  
    and at the end of the update function add this
    Code (csharp):
    1.  
    2. if(flip)
    3.             transform.localScale = new Vector3(-transform.localScale.x,transform.localScale.y,transform.localScale.z);
    4.  
    That will bring back the old flipping functionality - ill look into making a more permanent solution
     
    Last edited: Apr 11, 2014
  49. mojao

    mojao

    Joined:
    Sep 2, 2013
    Posts:
    42
    Hi,Mr.jamieniman. Ihave some question.

    1,In animation,I need to move root bone in the IK(top joint bone),but when this bone move, IK is not work collectory.
    Is there are way to move top bone?
    2.I want to edit IK joints limit angle, how to do this?

    If there are any idea, i feel very happy.
    thanks.
     
  50. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    783
    What exactly is going wrong for u with this? What should happen is the the limb should move around and the end bone (hand/foot) should stay in the same place.
    Not sure what u mean by IK joint limit angle? If u mean which way it bends, u can change this using the flip checkbox on the IK control