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. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Yup, its does now! Get the v1.5 update, just been released last night.

    You will see a scale checkbox on the controls, if you click this you will be able to scale the controls to scale the bones.
     
  2. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    207
    You can just change the alpha of the color of the material for the bones and controls to make them transparent.
     
  3. Wreckertike

    Wreckertike

    Joined:
    Feb 6, 2014
    Posts:
    5
    This looks really cool! I bought it last night but am a little stuck on drawing out the bones. When I try it seems to draw the bone in the hierarchy but nothing on the scene window. I get the error:

    "null texture passed to GUI.DrawTexture
    UnityEngine.GUI:DrawTexture(Rect, Texture, ScaleMode, Boolean, Single)
    Puppet2D_Editor:OnGUI() (at Assets/Tools/Puppet2D/Scripts/Editor/Puppet2D_Editor.cs:126)
    UnityEditor.DockArea:OnGUI()

    Any suggestions?

    Thanks cant wait to rig these guys!
     
  4. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    This is strange one - nothing I've seen before, could u check something for me, do you have this image Assets/Puppet2D/Textures/GUI/GUI_puppetman.png in that location?
    If you do, could u next try importing puppet2d into a fresh new clean project (to see if is in conflict with anything else)
    Make sure your scene view is set to 2D when u create your bones, and you are using Unity 4.3 or up

    If all that is good and ur still getting an error, could u send the project to me at puppet2d@gmail.com so i can see whats going on
     
  5. Wreckertike

    Wreckertike

    Joined:
    Feb 6, 2014
    Posts:
    5
    I checked the image was there, tried in a new project and seemed to work fine. Went back to old project, it gave some error about layout not working. Restore to factory settings, when i tried launching Puppet2D again no window came up. After changing the layout to 2 by 3, for some random reason its started to work again. No errors. No idea why.

    On a side note, can I only influence 2 bones at a time? If I want to make say a worm with 5 bones, is this possible?

    Thanks for the quick response!
     
  6. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    A newbie question: How does this package compared to SmoothMoves.
     
  7. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,145
    @ rocki :
    If i'm right, Smoothmoves works with pivot points. For an arm+ hand you need 3 sprites : upper arm, lower arm and hand ! The sprites rotate around these pivot points.
    With Puppet2d one sprite (full arm and hand) is enough. The bones and this sprite are parented to follow the "movement"...

    6R
     
  8. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Wondering if it's possible to create bones and skin character in-game ?
    Is there a run time API ?

    cheers.
     
  9. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Im glad its working fo u now. Something must have broken with ur layout.

    There is long and short answer to ur question.
    Short is - IK controls are for 3 bones like arms or legs, use orient and parent controls for other cases.
    Long answer - I have a plan for a new type of control for spines, tails (worms!) It will be really nice to animate with. There are ways also to link up multiple ik controls for unique rigging solutions, ill hopefully make some tutorials to show this when I get a chance.
    Im really looking to add more and more to puppet2d, to make it even more fun to use :)
     
  10. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Some of the scripts are held in the Editor folders, so I'm not sure that makes them accessible at runtime at the moment. Its definitely a possibility, I'll extract a few of the key functions from the editor so devs can make use of them at runtime. I'll add it to my feature list.
     
    jasonMcintosh likes this.
  11. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Very cool if Puppet2D has an Run time friendly API. It will make this awesome asset that much more flexible and powerful.
     
  12. Wreckertike

    Wreckertike

    Joined:
    Feb 6, 2014
    Posts:
    5
    Okay great thanks! Guess no worms for now ;) Great work guys, keep it up!

    $EnemySlug.png
     
    Last edited: Feb 7, 2014
  13. tayloredgames

    tayloredgames

    Joined:
    Jul 23, 2012
    Posts:
    4
    This is a great great great plugin, loving it so far and the possibilities are endless. $30.00 really makes this viable over the cost of Spine.

    Just a few issues:
    When boning limbs, if the GameObject and the IK Controller are called the same (e.g. ArmL, ArmL), Mecanim may have difficulty recognizing what to animate and can cause problems when creating multiple animations. This will effectively force all animations on the limb to be replaced. Renaming IK CTRL and Bone and fixing references on the inspector per object will fix this.

    Final Bones seem humungo, even when using the slider to modify all sizes. Additionally Global_CTRL bool to hide bones doesn’t seem to work, or not in the situation where you manually assign each sprite to each bone.

    Flipping the character can cause some issues (for walking left and right by example) with how the boning reacts. I know you’ve put in the functionality to flip the character. This is generally a Mecanim problem for 2D and just requires either flipping the character on Global_CTRL or setting the Y-axis to 180/0-.

    I note you’ve mentioned tails: we have tried setting up a character with a tail with a controller (controller on tip, bone connected to Hip bone) and this has caused all bones attached to a controller (ArmL, ArmR, LegL, LegR) to skew and break.

    I know some of the above might be nobrainers and/or are just teething problems.
     
    Last edited: Feb 8, 2014
    TheWarper likes this.
  14. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    heh whichever the case, this is always a bad idea to have two things with the same name :)

    If your tail has more than 2 joints, that's a normal issue
     
  15. tayloredgames

    tayloredgames

    Joined:
    Jul 23, 2012
    Posts:
    4
    It did only have 2 joints but it was just a case of not putting an IK Controller on it.
     
  16. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782

    Yup, its always important to have unique names - if u make sure u name the bones before u create the controls, the controls should always been nameed uniqely with _CTRL at the end.

    I've gotta improve the bone slider, im working on it at the mo actually. In the meantime u can manually change the Pixel Units by finding the sprites in the GUI folder and changing the value in the inspector.

    You need to parent the bones under the global_CTRL, then toggle the global_CTRL script. THis should wake it up to the new hierachy so that it know it has bones underneath it..

    Could u elaborate? Does the flip checkbox on the global_CTRL not work how ud like it to?

    I'm guessing u tried to put an IK controller on it (let me know if im wrong) if u did, u need to make sure it is at the end of a 3 joint chain - so if u have only 2 tail bones and a hip, chances are it messed up the hip.
    Im always happy to help, and improve Puppet2d where there are stuff which isnt as user friendly as it can be
     
  17. tayloredgames

    tayloredgames

    Joined:
    Jul 23, 2012
    Posts:
    4
    I had followed your tutorial initially (have a grasp of everything now) and set the Hip parent GameObject to child Global CTRL. It is possible to uncheck/check the Bones Visibility bool but it has no effect.

    Here's my hierarchy:
    $s8b5ZSy.png


    Oh no it works great. Mecanim just acts weird with 2D sprites that are made up of many components and with the combination of a rigidbody 2D the animated sprite doesn't flip on the Y rotation. I've just made a reference to the Global CTRL in script and modified it there, it's actually shortened the needed code to flip the sprite.


    It was only a 2 join bone, so as you say that would be the problem.

    I hope I didn't seem rude in my initial post, I just wanted to give some input/feedback and I really think you have a great tool here.
     
  18. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    For clarity - did u definitely toggle the Puppet2D_GlobalControl script after u parented the bones before trying out the bone visibilty check box?
     
  19. tayloredgames

    tayloredgames

    Joined:
    Jul 23, 2012
    Posts:
    4
    I've gone back and tried it again and it seems to be working now. I definitely attempted hiding the bones (after hiding the control) when I had childed it to Global_CTRL. My ignorance sorry. :)
     
  20. jimym

    jimym

    Joined:
    Apr 13, 2013
    Posts:
    8
    If your Sprite has a custom pivot when using the convert sprite to mesh the texture is offset to match the pivot.
    You can see this in practice if you convert the PuppetMan_gunSide sprite into a mesh.

    Hope you can find a fix for this as it is use full being able to set the pivot position for meshes.

    Thanks
     
  21. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Yes thats on my bug list, technically the bones replace the need for using sprites pivots though, do u still need them for something I haven't thought of?
     
  22. jimym

    jimym

    Joined:
    Apr 13, 2013
    Posts:
    8
    having control over the sprites or mesh can be very use full.
    Say i had a character who has a chest sprite or mesh attached to a chest bone.
    the chest bone is positioned in a hierarchy above the hip bone and below the neck bone.
    For example I wanted to animate the scale of the chest to make my character look like he is breathing .
    If I scale the chest bone the scaling will go down stream in the hierarchy there by scaling the neck and head and anything downstream.
    But by animating and scaling the chest sprite or mesh this is independent of the bones and has no knock on effect.

    As well as this It would make the convert sprite to mesh tool in Puppet2d very Use full for general sprite to mesh use.

    Thanks for the reply and thanks for Puppet2d :)
     
  23. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Nice explanation! Its certainly on my list. Ill let everyone know when its fixed.
     
  24. jimym

    jimym

    Joined:
    Apr 13, 2013
    Posts:
    8
    Been playing around with Puppet2d today and got to thinking it would be neat if we had a tweak bones option in the bone creation part of the
    puppet 2d editor.
    I Imagine any tweaking would have to be done before parenting or skinning to the bones.
    Unless The bone children ignore any input while in tweak mode.
    It could be similar similar to how move is when creating bones.
    Or while in tweak mode if you move a bonenojoint the bone before it in the hierarchy would adjust its scale and rotation to match the bonenojoints new position.
    No pressure mate just a suggestion :)
     
  25. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Ha! Thats what I was working on just before reading ur post!

    Great minds ;-)
     
  26. jimym

    jimym

    Joined:
    Apr 13, 2013
    Posts:
    8
    Superb :) look forward to the update :)
     
  27. Shapeforms

    Shapeforms

    Joined:
    Jan 27, 2014
    Posts:
    12
    Hi, I was wondering if there are plans to make Puppet2D work on planes besides XY? I have another Unity asset (Adventure Creator) which requires 2D games be made top-down, so unfortunately I haven't been able to use Puppet 2D with it. This would be a great addition to an already great tool :)

    Also, like others, I'd love to see functionality that enables tentacle-like rigging - that'd be super handy.
     
  28. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Changing the plane is on my list :)
     
  29. jimym

    jimym

    Joined:
    Apr 13, 2013
    Posts:
    8
    Having Fun With Puppet2d.
    While playing around I noticed if I select a control in the Animation curves window it selects that control in the scene.
    Would it be possible for this to work both ways.
    so when a control is selected in the scene the corresponding control is selected in the Animation curves window :)
     
  30. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Not sure how I would be able to do that. Would definitely be a nice feature :D
     
  31. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,804
    Hi

    I would like to know if this can play well i a fully 3D world, like assign any shader for the material and not be limited by the Unity sprite materials

    Also i work in z-y plane, is it easy to adjust the code for that ?

    thanks
     
  32. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    If u convert it to a mesh u can use any shader u like :)

    I'm going to add an option to change the plane, in the mean time perhaps contact eddie312 - he said he made a script to do it
     
  33. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,804
    Thanks

    So, you think the system could be integraded into a 2.5D (3D, fixed camera in z-y plane) game ? Does it use Unity animation system to call the animations ? And how does IK work in that case ?
     
  34. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Yes it should work for 2.5d, make sure ur z ordered sprites don't reveal the zordering trick tho.

    Animations can be done using mechanim or legacy animation - all in the classic Unity way.

    The IK controls have scripts which affect the bones, these update at runtime as well as at editor time.
     
  35. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,804
    If i use the mesh conversion and a custom (say cutout diffuse) shader, will i have a Z order issue ? I work in perspective mode

    For the IK, say i want a monster to have its tentacle attack the hero, can i put the script on the end of tentacle and pass the hero as target for example and work in real time ? Also can i determine the IK to work only on "Attack" animation and not globally ? I guess i could do that in code with an if case based on played animation ?

    Thanks

    EDIT: Just bought the package

    When i assign a animation (instead of the animation controller with the avatar) and populate with the animation asset, it does not play (i have play auto on). Is there any way around that ?

    I need an animation component on my heroes with the animations

    Also when i try to move the hero around, the animation gets broken, is there an option to fix that ?
     
    Last edited: Feb 12, 2014
  36. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Not quite clear of the problem... do u have an animation or animator component on the Global_CTRL?
    Are u moving the character around with the Global_CTRL? (If u want to flip the character u need to use the flip checkbox on the Global_CTRL)
     
  37. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,804
    I pick the whole character and move it, then try to run and the animation is broken

    Also i try to use animation instead of the demo's animator, that is when it does nothing
     
  38. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    You want to offset the demo characters animation into another position? You need to parent the global_CTRL into a gameObject and move that.
    The demo characters animation was done using the animator - if u want that animation to work on the animation component u need to change its settings. To do that u need to select the animation clip in the project, go to the inspector and selct the topright drop down and choose Dubug. Then u will see a value called Animation Type - set this to 1. Now the animation will be able to run on the animation component, but u will see that the sprite switching won't work anymore on the gun - this is a Unity issue, if u want to do sprite switching u need to use the animator component.
     
  39. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    7,804
    Thanks, everything is clear now :), i will start putting it to good use :)
     
  40. cpavanelli

    cpavanelli

    Joined:
    Apr 11, 2013
    Posts:
    6
    Hey, just asked this on your youtube chanel, but I think you're more active here :)

    I would like to know if it will work if I need to switch the texture of one sprite (changing a weapon, head texture and so on)

    Thanks in advance,

    Caio
     
  41. AndreasO

    AndreasO

    Joined:
    Sep 25, 2012
    Posts:
    90
    Hi,

    I bought your plugin and I like it. :)

    Do you have any advice on how to use the plugin in conjunction with NGUI?
    In NGUI, UISprites need to always be under an UIRoot game object so that it can apply a scaling factor to its children game objects for a specific target resolution.

    There seems to be a problem whenever I try to anchor an (NGUI) UISprite to a Puppet2D bone in the hierarchy.
    It seems to have to do with that scaling from the UIRoot game object which apprently breaks functionaly of Puppet2D bones.

    Regards
     
  42. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    If u are animating parented sprites u will be able to animate switching between sprites and see the keyframes visually I the animation editor window.
    You can't do this with skinned meshes at the moment though.
    Also make sure u use the animator component not animation if u want to animate the sprites switching.
     
  43. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Apologies ive got toolkit2d but not NGUI, are u parenting the global_ctrl into UIRoot?
    Sorry im not more help with this, is there any NGUI Puppet2d user out there that has a solution?
     
  44. jimym

    jimym

    Joined:
    Apr 13, 2013
    Posts:
    8
    not sure how NGUI works but what if you make the NGUI sprite a child of an empty game object and attach the empty game object to the bone ?

    Or get an empty game object to update its position to the required bone and have the ngui sprite attached to the game object.that way it doesnt have to be attached to the puppet game object at all.
     
    Last edited: Feb 15, 2014
  45. Caffeen

    Caffeen

    Joined:
    Dec 25, 2013
    Posts:
    28
    GREAT plug-in, I'm just having issues with it.

    This is going to be tough to describe, but here goes. I have Bone chain B and Bone A. If I create an IK handle for B and then parent the control to Bone A (So that B moves relative to A's movement) it works how I'd expect it to, but then if I save and reload the scene, the control for B breaks and no longer affects B, and I have to delete B's controls and re-create them. It'll then work again just fine until the next save/reload.

    I'm not 100% sure that I'm setting up the parent/child relationships correctly to get the functionality I'm looking for, (Literally just parenting the CTRL group the bone I want it to move relative to) but I'm assuming that moving an IK handle relative to something else and still have it work is an intended function? The fact that I can get it to work, and then it breaks when reloading is what puzzles me.

    Any idea what I'm doing wrong?
     
  46. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Sounds like it could be this - the global_CTRL is what controls the execution order of the individual controls. When the the script on the global_CTRL is toggled On/Off (or on reloaded scene) the global_CTRL re-finds all the controls underneath it and so probably changes the execution order.
    Try this - open the Global_CTRL script and comment out the OneEnable function. Its a temporary fix for now, Im going to look to improve this soon
     
    Last edited: Feb 16, 2014
  47. Caffeen

    Caffeen

    Joined:
    Dec 25, 2013
    Posts:
    28
    Thanks for the quick response! So if I'm reading this right, having EVERYTHING parented to the global_CTRL should fix this?

    EDIT: Yep! That solved the problem. I didn't have all of the bones parented under the global_CTRL, yet. With them parented to it, the IK control functionality seems to be preserved prior to save/load. Thanks again!
     
    Last edited: Feb 16, 2014
  48. cpavanelli

    cpavanelli

    Joined:
    Apr 11, 2013
    Posts:
    6
    Thanks for the response, but I'm afraid that's not what I was trying to ask, hehe.

    Let's say I have a regular head, with all animations already created to it, and depeding on what happens on the game(runtime), i want to switch it to another texture, with a hat, or simply with an diferent skin color (but with the same size).
    In that case I'm hoping that the animation will work fine, so my question is: will your component work with it? :p

    let me show an example of the code I wrote to do this.

    (outside method)
    public Transform playerHead;

    (inside method)
    Sprite img = Resources.Load<Sprite> (headToload);
    SpriteRenderer renderer = (SpriteRenderer)playerHead.GetComponent ("SpriteRenderer");
    renderer.sprite = img;



    Thanks again :)
     
  49. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225

    If you're just trying to change a sprite source component with code in runtime, you can do it. Sprites are still Sprites in puppet2D.

    But if you're trying to change a skinned mesh texture, it's not possible actually. That's what Jamie tried to explain.
     
  50. jamieniman

    jamieniman

    Joined:
    Jan 7, 2013
    Posts:
    782
    Are you asking this:

    Say you have two versions of an alien, blue version and green, and they both are seperate sprites with 2 expressions happy and sad, so you want an animation that works to switch it from happy to sad, and in code u would change it from blue to green keeping the animation?

    Thats an interesting question, I haven't tried it yet, but my guess is the way the animations work is to reference the actually sprite directly not by ID, so it most likely would not work. (BYW this is something u could try without Puppet2D, the sprite switching is a Unity feature since 4.3)