Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Humanoid rig setup problem

Discussion in 'Animation' started by TremesEx, Jan 28, 2014.

  1. TremesEx

    TremesEx

    Joined:
    Nov 6, 2013
    Posts:
    28
    I got a problem that i need help with.

    I have a rigged and animated character from blender with weapons in his hands also animated. When I imported it to unity and set the rig to Humanoid, the animation on the weapon is gone and the weapon just sits in one place without animation.

    Why is that? is there something i need to do in blender or in unity to make it work?
     
  2. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    I had a similar problem w gun animation. you can make the gun animated by assigning vertices to the skeletons hand joint (dont know why its not animated in yor case), but
    seems like its better to go with weapon at 0,0,0 pivot and set it up in unity. so you animate just the character and parent the weapon to his hand in the unity editor.
     
  3. TremesEx

    TremesEx

    Joined:
    Nov 6, 2013
    Posts:
    28
    The weapon is one single mesh and is rigged with bones to control the weapon parts(trigger, mag, etc.) but the root bone of the weapon is not parented to the hand bones, Im using constraints to animate it. It stays at the 0,0,0 coordinates.

    Even if i parent the weapon to the hand bone in unity, it still wont work beause I have a reload animation for the weapon(gun). The animation includes pulling the mag and pushing the bolt for an MP5. Thats why i want it animated.

    Thanks for the reply
     
  4. TheCCJ

    TheCCJ

    Joined:
    May 2, 2013
    Posts:
    71
    Do you have animation data of any sort on the root bone (translation, rotation, anything)? It could be that, if you do, those are overriding the constraint and causing the gun to stay at it's relative origin.

    If it does, you may want to try to export a version of the gun without anything on the root, and see if that solves it, so that there's not any competing data.

    (Note: this is from my experience in other packages and engines -- I've no idea if this is the case in Unity or not, but without having access to everything, it seems plausible)
     
  5. TremesEx

    TremesEx

    Joined:
    Nov 6, 2013
    Posts:
    28
    The gun is weighted and rigged and i use bones to animate it. And I always bake the animation before exporting them to fbx. So the animation is baked to the root bone of the weapon and the constraint from the hands are removed when baking in blender. Then i export

    It works with generic rig. How come it doesnt work with humanoid?
     
    Last edited: Jan 29, 2014
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,545
  7. TremesEx

    TremesEx

    Joined:
    Nov 6, 2013
    Posts:
    28
    Nice finally an answer to my problem. It works now, the animation on the weapon is working but there is one problem though. The weapon is offsetted. Its floating above my character's hands.

    And in the tutorial i cant see this part in my unity "Create new Avatar mask and include all of your joints, then apply that mask to all animations, that you have on your character..."

    I dont see the red texts in my unity and i dont think i need to mask anything, i just want the gun animation to work.
     
    Last edited: Jan 30, 2014
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,545
    It sounds like the bones are being included, since the animation works, so you shouldn't need to do anything more regarding the red text.

    Sorry, I don't know why the gun would be offset. Maybe it's a scaling issue. Experiment with different scaling settings on the Model tab.
     
  9. TremesEx

    TremesEx

    Joined:
    Nov 6, 2013
    Posts:
    28
    I tried messing with the scale but still nothing.
     
  10. 3DCWCURTO

    3DCWCURTO

    Joined:
    Dec 30, 2012
    Posts:
    19
    Weapon is same mesh as character right. You weighted the weapon to the root bone?

    I had a similar problem with a sword. I changed the hierarchy of my sword so I had a sword bone as the child of the hand bone and it worked better. Originally I had my sword bone as child of the hips and it would be in the right place at keyframes but when interpolating it would float out of the hands and back into them.
    I also found some weird bug that will cause my sword to float out of the hand or not properly animate. After importing and before changing to humanoid if you change some settings on a animation and apply it automatically checks all the extra bones so they work. Then changing to humanoid if you change the start frame of an animation it can break the extra bones. Maybe checking the box to use the extra bones before changing to humanoid is giving you an issue. Try importing, changing to humanoid ,then manually checking each extra bone box on each animation.
    After changing your hierarchy first tho to see if that's the problem.
     
  11. unity_6BymWZ9P1U9Xhg

    unity_6BymWZ9P1U9Xhg

    Joined:
    Apr 5, 2021
    Posts:
    4
    Even now it doesn't work, it's incredibly S***ty this unity can't humanoid character do.