Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Puppet2D - An advanced skeletal animation tool

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

  1. mojao

    mojao

    Joined:
    Sep 2, 2013
    Posts:
    42
    Hello,Mr.jamieniman,Thanks!
    Probrem In 1. is, when sprite is change,the joint place will change too.(in example, when twist body, shoulder place will change,)
    So,i want to move joint,but then IK is not work collectly(move IK bone is rotation very fast)
    So, if there are way to replace,i feel happy.

    Problem 2 is OK, thanks!
     
  2. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    No webpplayer demo example to see how it moves in real example ?
    Are movements interpolatted and smooth ?
     
  3. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    the movements are inherent to the Unity animation engine. Puppet2D only help to create complicated setup/movements
     
  4. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It is possible to change some sprite parts for others , like replace in the animation a hand sprite to a fist sprite ?
     
  5. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Yup, if this is sprites ( and not mesh ), you can animate ( switch ) them with the Unity Animation window.
    Again, it is not related to puppet2D ;)
     
  6. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    ok thanks.
    But it's visible in the Puppet animation editor so ? I mean you see the hand open chaning to a fist during puppet animation ?
    Sorry, i 'm new to 2D with Unity.
     
  7. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Yes it is visible in the Scene view.
    You can see Jamie using a texture switch in his tutorial video.
    Puppet2D doesn't manage the sprite switching thing, you have to to this in the Animation window or in the inspector ( while animating ); it is a unity 4.3 feature related to sprites.
     
  8. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    Hi mojao,
    I'm not Jamie, I'm just a user of puppet2D.
    I'm answering because I can and to help people, that's what a forum is designed for.
    Rating a 1 star because you didn't have an answer to your problem 1 day after is a bit dumb imho. I also have some issues with puppet2D and I'm working with Jamie to resolve them patiently; that's how software dev is working.

    Now if you want more help with your issue, please post more details ( images, gif, videos... ) because actually, I don't understand what you're trying to do so I can't (myself ) provide any help. And if this is something to implement/resolve, Jamie need to see precisely what's going on : same needs.

    Have a nice day
     
  9. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Wow! I went away for 2 days, thats why I couldn't answer your question!
     
  10. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    The animation editor window is a Unity feature. Puppet2d gives you the bones and controls that you can animate using the animation editor.
     
  11. mojao

    mojao

    Joined:
    Sep 2, 2013
    Posts:
    42
    Sorry. i deleted my post and i apologize my act.
    It’s not your fault, Mr.zenshark and Mr.jamienieman.
    I will correctionmy review. sorry i was in a temper.
     
  12. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    thanx :)
     
    Last edited: Apr 20, 2014
  13. RyuK

    RyuK

    Joined:
    Feb 12, 2014
    Posts:
    55
    Hi I have a couple of questions about the demo scene (scene/puppet2DDemo.unity).
    In the demo scene, when I set the aspect 16:10 portrait, skin textures are shown only in the Scene view, they are not shown in the game view. When I hit play, in the Game view, some skins are not shown and some bones are shown. Why is it like this? If I set the aspect Free Aspect, all are shown as expected.

    Another question is, I'd like to make the skeleton stand up with their feet with physics, is it possible by adding Physics2D objects to footR_CTRL and footL_CTRL gamebodies in the demo scene?

    The last question is, how can I edit puppet2d_shoot.anim animation?

    EDIT: OK I unchecked Controls Visibility and Bones Visibility, then controls are not shown in the Game view, but still only the arm is shown in the game view when the aspect ratio is 16:10.
     
    Last edited: Apr 28, 2014
  14. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    If you zoom out, you will likely see it pop back into view. This is because currently the
    "Update When Offscreen" checkbox is not set on the skinnedMeshRenderers so when the camera is not looking at the original bounds of the meshes it will disappear.

    Actually, having a look at it, when the global_ctrl combines the meshes (at runtime) it doesn't set this value, it looks like I should add this to the global_ctrl as a checkbox.
    I don't see why not, let me know how it goes :)
    Its not locked - all u need to do is select the Puppetman_Global_CTRL, open the animation editor and press the red record button to get started :)
     
  15. LaraIsabel

    LaraIsabel

    Joined:
    Apr 15, 2014
    Posts:
    4
    Hi, I just bought the plugin and I have a few questions.
    1- Is it mandatory to convert sprite to mesh? I don't really understand how it works and I couldn't find any info on the tutorial or forum.
    2- After I "parent object to bone" I try to animate, I create a new animation and move an IK control, but when click on another IK control it creates a new animation instead of working with the previous one. I believe the error is in the hierarchy but I couldn't make it work after several hours :(

    Any help would be much appreciated.
     
  16. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    There are two ways to setup your character in puppet2d - skinning or parenting. You can always do one or another or both as in the example.

    Parenting means only 1 bone can influence each sprite or gameobject. Its more optimised that using skinning. Parenting you don't use convert sprite to mesh, only "parent object to bone".

    Skinning on the other hand means you can have multiple bones influence the same object. This can be useful to get it to deform as u bend the limbs or spine etc. For this you need to first convert sprite to mesh and then select it along with the bones and click "bind smooth skin". You don't want to be using "parent object to bone" - u should just parent it directly onto the global_ctrl.

    What has happened here is you have created a unique animator component on each IK control. What you want is an animator component only on the global_Ctrl - when you first animate the character you should first make sure you create one on the global_ctrl (either by animating it or creating the component manually). Once you've done this, when you animate any of the children (eg the ik_control) the animation will go on the global control.
    To get it working now - make sure you delete any animator components u have on the IK_controls and then select the global_control and animate/create an animator component on it.

    Hope that helps :)
     
    TheWarper likes this.
  17. RyuK

    RyuK

    Joined:
    Feb 12, 2014
    Posts:
    55
    Thanks for the answers, now I'm following your video tutorial to add bones and skins to my own sprites in a PSD, but when I apply "Convert Sprite to Mesh", it creates a mesh that includes some parts of other sprites in the PSD. I added PolygonCollider2D just like in your tutorial video, but a mesh with a different shape from that of the collider is created actually. Could you give me a workaround for this issue?
    (By the way what do "Type of Mesh" and "Num Skin Bones" mean?)

    EDIT: well I put the sprite that causes the issue in a separate PSD and tried again, but the result is the same. I sent you the PSD at your gmail, please take a look at it (if you don't find my email, please look in the spam folder!)

    EDIT 2: I set 1 in the "Type of Mesh" (which was 0 originally), and now it seems to work again! Hmm, is it explained in somewhere already?? In this case, the PolygonCollider2D is automatically removed from the gameobject.

    EDIT 3: Oh, and this is a trivial question, in the video you move hands and legs and then they snap to go back to the original position, how do you do that? I just press Ctrl+z to do that, but is there another way or not?
     
    Last edited: Apr 28, 2014
  18. Caffeen

    Caffeen

    Joined:
    Dec 25, 2013
    Posts:
    28
    I have to say that this is an amazing plug-in and that my entire project would not be possible without it, so thanks for that!

    However, I am currently beyond frustrated with it. For weeks I'd had a bug that I thought was minor/my fault and an easy fix when I got around to it. (Basically particle effects that were parented to a flipped object were not behaving as expected, like moving/rotating opposite of what its parent was.) I tried a thousand different things thinking I had just messed up somewhere.

    So I finally thought to try updating Puppet2D, and suddenly it works! My excitement is short-lived, however, when I realize that my character no longer flips when he should. I looked through this thread and found where you replied re: this bug and gave the code to place into Puppet2D_GlobalControl.cs. I did so, and hurray, it flips again! However, the original bug is now back, and particle effects parented to a flipped object behave opposite of their parent.

    It seems I can't have both things working properly at the same time. Any help would be amazing, as I'm actually supposed to be releasing today, and this is literally the only thing standing in my way. Thanks in advance!
     
  19. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Don't you worry, you're just in luck as I've just submitted a new release that fixes both the flip thing and the mirror problem thingy (you know what I mean!)
    As it will take a week or so for Unity to approve it - please send me your invoice number straight away and ill send you v1.9 pronto :)

    (Send it to puppet2d@gmail.com)
     
    Last edited: Apr 28, 2014
  20. RyuK

    RyuK

    Joined:
    Feb 12, 2014
    Posts:
    55
    Well I added BoxCollider2D and RigidBody2D to footR_CTRL and footL_CTRL gamebodies, now it can put feet on the floor, but it caused bad side effects. It has weird jittering now (legs shake constantly). Is it possible to avoid it by adjusting Physics2D objects parameters?
     
  21. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    I'm not sure - i wonder if its got to do with the execution order between the rigidbodies and control scripts. Possibly try this - open the Puppet2d_GlobalControl.cs script and change the Update function to a FixedUpdate function (I haven't tried it, just a quick thought i had now).
     
  22. RyuK

    RyuK

    Joined:
    Feb 12, 2014
    Posts:
    55
    Thanks, with 1.9, I changed Update to FixedUpdate, then used Interpolate for Rigidbody, and it got less jerky, though it's still not perfect. I set BoxCollider2D in feet, maybe these colliders aren't good for this use, I'll continue to tweak them to see what happens.
    What I'm wondering now is, though I added rigidbody2D to the feet, this walking puppet doesn't fall off of the sky. I set gravity scale and mass for the rigidbody. I put the puppet on the floor by moving transform position manually. What do I have to do to make it affected by the gravity?

    (By the way I tried to put Global_CTRL in an empty prefab and reuse it, but for some reason when I put prefab on the scene back again some parts in the puppet are gone. Are there some restriction to do so with Puppet2D? Can I put 2 or more puppet2D-controlled objects on screen?)

    EDIT: I tried Flip in 1.9 too, can it be changed only in runtime? If I check Flip before playing it, it starts from the non-flipped state. There's another issue, on the Unity Inspector, I checked Flip while it's playing, then the parts with rigidbody2D (in my case, footL_CRTL and footR_CTRL) disappear. If I remove rigidbody2D, they appear again.

    EDIT2: Comparing the original object and the prefab, the prefab loses the mesh specified in the Mesh Filter (it points to none) and the Mesh in the Skinned Mesh Renderer. I'm trying to restore them, but it seems the mesh created with type 1 was not stored properly.
     
    Last edited: Apr 29, 2014
  23. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    How do u want it to work? Do want it respond to gravity and you're animation?
    This is likely because of the overwrite mesh bug - hopefully this should not happen with the 1.9, (when you click overwrite mesh in 1.8 it had a bug where it didnt save it into the assets folder - so if u created the mesh using 1.8 it could be still broke in 1.9.
    You have a rigid body on the controls (its not a standard use of puppet2d). Are you saying it works in runtime but not editor time?
    Yup - as I mentioned above ^
     
  24. RyuK

    RyuK

    Joined:
    Feb 12, 2014
    Posts:
    55
    I expect the puppet responds to gravity and falls if no ground is under its feet. It stays mid-air right now, if I put it high above the floor without making its feet touch the floor.

    Yes, even though I check it in the editor then press play, it start as if there's no flip. This happens when no rigidbody are attached to CTRLs.

    (The mesh issue could be fixed by recreating re-binding them :) It seems I forgot to overwrite mesh)
     
    Last edited: Apr 30, 2014
  25. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Im not able to reproduce your flip issue with 1.9 - could u send me the broken scene packaged up with ur version of puppet2d?
     
    Last edited: May 1, 2014
  26. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    v1.9 has been updated on the AssetStore

    The changes are:

    - Fixed Flip Runtime bug
    - Fixed Overwrite Mesh bug (now saves to assets)
    - Size of Bones/Controls/Vertex persists after save
    - Unable to break skin weights by selecting None (removed this unnecessary option)
    - Binding Skin Keeps Sorting Layer info
    - No longer breaks hierachy when you put an IK on the end of 2 bones
    - Global_Ctrl Combine Meshes Keeps Update Offscreen Info

    If you'd like to know more about the fixes, don't hesitate to ask
     
  27. Caffeen

    Caffeen

    Joined:
    Dec 25, 2013
    Posts:
    28
    I just released my first game on the Google Play store, and it was animated entirely with Puppet2D! (In fact, I don't think it would have been at all possible without it.)

    You can check it out HERE if you'd like to see what Puppet2D is really capable of. (And if you want to rate it while you do, I won't that'd be awesome!)

    Thanks Jamie for a fantastic product! (1.9 fixed everything!)
     
    Last edited: May 2, 2014
  28. RyuK

    RyuK

    Joined:
    Feb 12, 2014
    Posts:
    55
    Hi, I have another physics-related question, I attached a 2D collider rigidbody to the hand of a puppet (such as the gun for the demo project). I set the gravity scale as 0 on the rigidbody2D. When something hits it, the arm flies away detached from the body. I tried the both sprite and the control objects as the target for that matter, but in the both cases the arm falls off. How can I add a physics2D object to a part of a puppet body properly?
     
  29. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    The Ik control doesn't have anything restricting its position, so naturally if it has physics on it, the control will fly off. (Of course the arm will still point towards it).
    Sounds like you're trying interesting things with Puppet2D, let me know if you get any results :)
     
  30. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Thats excellent - the first released Puppet2D game (as far as I know!). Thanks for sharing - the link seems to be broken though ...
     
  31. LaraIsabel

    LaraIsabel

    Joined:
    Apr 15, 2014
    Posts:
    4
    Hi. My character has several sprites, for example for the head: nose, mouth, dead mouth, glasses, dead glasses, earrings... and not all of them have to be visible all the time.

    When I'm making the "dead" animation and I want to hide "mouth" and unhide "dead mouth" it opens a new animation :S How can I fix that? How can I hide a sprite?
     
  32. Caffeen

    Caffeen

    Joined:
    Dec 25, 2013
    Posts:
    28
    WHOOPS, looks like I fat fingered while I was creating the link. Link is fixed now!
     
  33. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    You can switch the sprite on the first frame to the dead mouth (also make sure you dont have an animator component on the sprite - as this will cause you to create a separate animation from the one on the global_CTRL
     
  34. RyuK

    RyuK

    Joined:
    Feb 12, 2014
    Posts:
    55
    Ah, OK. I will try to make another tree of gameobjects that has colliders on them, and make them change positions when the corresponding parts of the puppet body changes positions and look how they work.
     
  35. LaraIsabel

    LaraIsabel

    Joined:
    Apr 15, 2014
    Posts:
    4
    Doing this it changes the sprite in the rest animations also :( That's the problem, when I change the sprite it affects to all the other animations made.
     
  36. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    it's surely because you don't animate the sprite changement
     
  37. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    It shouldn't affect the other animations if you make sure to just switch it only when the red record button is clicked on the animation you want to change.
     
  38. LaraIsabel

    LaraIsabel

    Joined:
    Apr 15, 2014
    Posts:
    4
    Thank you both of you :) It's working now.
     
  39. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602
    Hi all, I'm a Game Designer, and in school for my BA for Game Production. I been debating about which program to buy. I looked at Spine, I like that it uses 2D tool kit. Does 2D Puppet use it at all?? Also I seen very little tuts on 2D Puppet and nothing on Runtime. This concerns me..
    Now Spine is over $200 for the pro, the Ess looks like it does not do any deform or skinning. Now 2D Puppet does, which is huge and its 30 bucks. I don't mind paying for something but I want to make sure its a good program and its going to do what I want and be good for my workflow.

    Anyways I make a lot of 2D games, so again does it work with 2d tool kit and if so, what does it do?
    Also any Tuts or info on RunTime for 2D Puppet.. I never used it so I have no idea, only seen 2 tuts at all out there. Also I was wondering why he does not have a forum with more info to help others? Not bashing him, its a lot more useful to the users.

    Anyway thanks for reading and any Input on 2D Puppet compared to Spine.s

    Cons and Pro's to both would be awesome.
     
  40. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    You can make use of Puppet2D's skeletal system with 2d toolkit sprites. But if you want mesh skinning (where the vertices get influenced by multiple bones) you need to use a unity sprite and convert it to a mesh for skinning.
    If you have any questions feel free to ask here - sorry I don't have a forum on the website. You can also always email me at puppet2d@gmail.com
     
  41. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602
    Ty for the fast reply. Now for the 2d Tool kit how much of it can be used, can we use it in run time.?

    Or it this just atlas use only, how much of the 2d tool kit can 2d Puppet be able to use. I normally use 2d tool kit, to set up my sprites in the collection, then add to a sprite animation, so play each animation, now will I still be able to do this with 2d Puppet, or is it limited to just collections. Again, I just heard about this. I been doing it the old fashion way in photoshop , 2d puppet looks like it will speed up my work flow and even make it better.

    So trying to see how much of 2d tool kit works with this since I love using it.
     
    Last edited: May 4, 2014
  42. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    You could use toolkit2d's collection texture packing to get it laid out onto an atlas. But then in order to create meshes out of it u would need to to make it a sprite, open it with the sprite editor and get unity to place all the UVs for the sprites. You could then use these sprites to convert to mesh for skinning. You wont beable to recommit the collection after doing that though, as it will change the atlas lay out.

    Of course - u can always use toolkit2s sprites parented to bones - theres alot u can do without skinning btw
     
  43. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602
    Ya, that was mainly what I was asking, with out skinning, what uses do I have with 2d tool kit still?
     
  44. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    You can totally make use of 2dtoolkit sprites if you're not skinning them. You can use all the atlas creation and batching etc, all u need to do is parent them to the Puppet2d bones in the setup.

    As a side point, I've recently added a new optimisation feature where you can bake all the control animation onto the bones. This allows you to animate using the IK controls, and then remove them after you've finished - removing any runtime scripts from the game (all u have is animated game objects) - check out this tutorial for more info - https://www.youtube.com/watch?v=dXD4-WS89tA
     
  45. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602
    Perfect that's the answer I was looking for mostly. Thanks

    Sorry if I was not clear.
     
  46. tiagoroldao

    tiagoroldao

    Joined:
    Dec 9, 2013
    Posts:
    4
    Hey Jamie, two quick questions:

    The Puppet2d scripts don't seem to play well with web builds. Is baking animations the only way to get them to work there?

    Also on baking - it only works when the animator component is in the Global_CTRL object, correct? Is is possible to do when the animator in in a parent object?
     
    Last edited: May 6, 2014
  47. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Theres currently an error with one of the lines in the mesh conversion code when u switch to web player. Just comment out the broken line and you should be able to build fine. (Uncomment it out and switch to another platform if you want to convert a sprite to mesh).
    If you put a Puppet2D_GlobalControl script on the gameObject that has an animator it will bake everything underneath it.
     
  48. tiagoroldao

    tiagoroldao

    Joined:
    Dec 9, 2013
    Posts:
    4
    Damn you! There was I, already crafting my 1 star review.. Thanks! :D
     
  49. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Few!
    If you have any other questions, don't hesitate to ask :)
     
  50. grofie

    grofie

    Joined:
    Dec 9, 2013
    Posts:
    15
    Hi Jamie,

    I just ran into a problem (actually two, but the solution solves both):

    Building on a Windows phone gave us the following exception:

    Error building Player: Exception: Error: type `System.IO.Compression.GZipStream` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Void TriangleNet.IO.DebugWriter::Finish(System.String).

    Building for webplayer gave us this exception:

    Assets/Puppet2D/Scripts/Triangulation/Triangle.NET/Triangle/IO/DebugWriter.cs(123,38): error CS0117: `System.IO.File' does not contain a definition for `ReadAllBytes'

    The call for DebugWriter.Session.Finish() is in annotaion marks, so I just removed the problem lines. Afterwards, both builds are compiling fine.

    Maybe you should wrap the function code with #if DEBUG [...] #endif or just comment it out for release as well.


    But the pluggin is really nice, keep up the great work!