Search Unity

Keep additional bones Skeleton masks

Discussion in 'Animation' started by Craptree, Nov 12, 2013.

  1. Craptree

    Craptree

    Joined:
    Oct 29, 2013
    Posts:
    39
    So I have a humanoid avatar setup that made use of the "keep additional bones" checkbox. In the new version of Unity, 4.3.0, this checkbox is gone and in the changelist it says:

    I can't find any information regarding the skeleton mask and how to retain custom bones and their animation. At the moment my character is all broken and sad. Anyone know how the skeleton mask feature works and where to find it?

    I want to be able to keep using mecanim but it feels as with every step forward I have to take two steps back. :(
     
  2. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    I'm in the same situation. As a side-note I'm frankly amazed that such a game-breaking change doesn't come with a dedicated page showing how to implement the new workflow.

    And as you can see on this page, the documentation has not been updated and still references the "Keep Additional Bones" checkbox: http://docs.unity3d.com/Documentation/Components/class-Avatar.html

    Also, here's the page regarding Avatar Skeleton Mask: http://docs.unity3d.com/Documentation/Components/class-AvatarSkeletonMask.html

    As you can see the page is... not quite helpful. It's just one line and I believe that line is not entirely accurate. I'm going to investigate the matter and post the results here, as this new feature basically discards any secondary animations on humanoid rigs (?!)...
     
  3. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    Alright, got it working. It's not as simple as checking the "Keep Additional Bones" but it does give you more control over what animation curves are used in-game (for optimization sake). So here are the steps to get back your secondary animations on humanoid rigs:

    1) Create an Avatar Mask (Assets->Create->Avatar Mask).

    2) Click and drag your character's avatar (usually within the character's asset itself) in the avatar field. Click on the button to import the skeleton from the avatar.

    3) Open the "Transforms" sub-section and tick all the check-boxes for the joints/transforms you need in-game.

    4) Select one of your character's animations in the project window and open the "Mask" sub-section in the "Animations" tab.

    5) Choose "Copy From Other Mask". Choose the avatar mask you created in step 1. Click "Apply".


    Now the pain in the back is you're going to have to reproduce step 4 and 5 for each of the character's animation clips. But the good news is that if you decide later on you need to change what joints animations should be seen in-game you just have to modify the avatar mask once.

    Hope that helps...
     
    SethMeshko likes this.
  4. Craptree

    Craptree

    Joined:
    Oct 29, 2013
    Posts:
    39
    EDIT: You solved it as I was typing my answer? Wow! Timing!

    EDIT2: I'll try your solution the moment I get home.

    I'm so glad I'm not alone! ;)

    Let's work together and try to solve this issue. I will update this thread with anything I find out during my attempts to solve this thing.

    I only had time to do some basic testing yesterday but I found that my custom bones are working and animating on one of my animations but they are dead on all the others. This is really really weird since I can't remember doing anything specific to actually getting them to work. I will continue experimenting tonight and see what I can find out.... I just need to find a way to keep my additional bones or I'll have to switch to legacy or some other system.
     
  5. instruct9r

    instruct9r

    Joined:
    Aug 1, 2012
    Posts:
    148
    cheez.. Thanks for that info :)... I was like wooow, where the #@$#@ is the animation of my additional bones...
     
  6. instruct9r

    instruct9r

    Joined:
    Aug 1, 2012
    Posts:
    148
    Something interesting i am thinking thouth. I have my player shooting while walking / running, etc... The shooting clip is in another Layer and i have applied different AvatarMask to that Layer, but now i can also apply that Different AvatarMask to the shooting animation directly. So will there be a point for applying them to both places?
     
  7. Craptree

    Craptree

    Joined:
    Oct 29, 2013
    Posts:
    39
    So using an avatar mask all my custom joints are behaving as intended. Thanks for figuring out what to do Seith!

    I'm still having a problem with my animations though. Viewed in the preview window or played back as a legacy animation they play back flawlessly. When run through mecanim though they don't loop perfectly - it's as if there are some kind of noise introduced once mecanim plays them back. Anyone run into something like this? I've spent countless hours trying to figure out what could be wrong.
     
  8. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    @intruct9r: Good question. I don't know about that though. Let us know when you manage to get it working though...

    @Craptree: You're welcome. Did you make sure that you're not using compression on the animation import settings?
     
    Last edited: Nov 13, 2013
  9. Craptree

    Craptree

    Joined:
    Oct 29, 2013
    Posts:
    39
    Like always I solved the problem just minutes after posting... why is it always like that? :)

    Yeah, I don't know why but when I upgraded to 4.3.0 all my animations turned on animation compression again without me knowing. Tweaking it / turning it off solved the problem!
     
  10. instruct9r

    instruct9r

    Joined:
    Aug 1, 2012
    Posts:
    148
    ok. The normal Avatar Mask have to be applied to all the animations (Except if you realy want to ignore some body parts). But for my shooting i had to apply the same (Full Avatar Mask) as for the other animations, cuz otherwise the ignored bones, returns to their original pose, which looks weird... Then i just use again the other (ShootingMask) avatar mask to the layer for my shooting.

    I have some problems though. If i keep the same setUp as before (4.2) my player is crouching little bit while shooting, which is pretty weird, cuz i have no animations, than the arm. Something that i have noticed that is if i watch the layer for shooting, for first time, that i play the scene, the Idle (Empy clip) is looping, but when i shoot once and the shooting ends, the empty clip doesn't play anymore, it just stays at the begining..

    If you have some clips on separate layers coud you try, to see if have something different, and check if your base clip (Which shoud be empty by default) is playing after the animated clip plays once...
     
  11. instruct9r

    instruct9r

    Joined:
    Aug 1, 2012
    Posts:
    148
    ok I'll try to explain something, that i see as problem. Not sure if it happens to me only or it's a bug.

    In Unity 4.2 when you have additional animation Layer, the workflow is usually this: Add one empty clip, from which the animation that have to be masked is transitted. When we call that animation and leave the transition back to be as " Exit", after the masked clip plays, the transition turns back to the Null clip (Empty clip) and starts looping it, untill we call the animation again.

    in Unity 4.3, when the masked animation plays once, it transits back to the null clip, but the null clip doesn't start playing anymore. Thus i get some weird motion on my root, which i didn't have before.... Do you get that issue as well?

    P.S. here's 2 images showing the difference between 4.2 and 4.3 with absolutely the same project
    $Unity_4.3.jpg

    $Unity_4.2.jpg
     
    Last edited: Nov 14, 2013
  12. Craptree

    Craptree

    Joined:
    Oct 29, 2013
    Posts:
    39
    instruct9r, I haven't gotten as far as using layers yet - but I'll dive into that territory very soon.

    I only have one problem remaining now. I parent a weapon to my characters hand but since I upgraded to 4.3.0 the weapon is offset and not rotated correctly. Anyone had problems like this? When I cycle through my weapons the attached weapon get more and more out of sync. My code worked fine in 4.2 and when tried on the same skeleton setup and mesh but in Legacy mode it works exactly like it did before. I guess I'll have to redo parts of my code but I just have to identify first what is happening with my joint that I parent my weapon too so I can tweak my code accordingly.
     
  13. deltamish

    deltamish

    Joined:
    Nov 1, 2012
    Posts:
    58
    Hi, Should the Hirearchy of the weapon (Left ForeArm/LeftHand/Weapon) be same on all avatar masks cause it doesnt work with diffrernt hirerarchy(Spine / Weapon).But it used to work with Unity 4.2.2 using keep additional bones.Can someone please inform me on how to make the mecanim to work with other order as well

    Thanks