Search Unity

Soldier holding a gun

Discussion in 'Animation' started by Soumikbhat, May 21, 2014.

  1. Soumikbhat

    Soumikbhat

    Joined:
    Nov 23, 2013
    Posts:
    110
    Hello all, I'm new to animations and just leared the mecanim system of animating in unity.

    What I want is this:

    My character should hold a gun and perform some mocap animations as given in the Animator Panel.

    But my problem is that whenever I have anyone of the default animations playing like walking/running of the MOcap Asset provided by Unity Assets under the free section, the hands of the soldier do not remain in the holding-gun position. I tried Body Mask by preventing the hands from playing the animation, but what I want is that the hands should be in a custom pose set by me, and not by the animation. I tried to set the hands in a gun-holding position by rotating the bones/muscles etc. but neither did that work, since this strictly recommends that the character stays in a T-pose - which is not possible once I change it to a gun-holding position.. :(
     
  2. Keemo

    Keemo

    Joined:
    Apr 22, 2014
    Posts:
    31
    You need to create a new Layer and create a new Avatar Mask where u only selected the arms. Then you can choose a weight for that layer and when u use 1, the character will always hold his arms in the position u want.
    https://docs.unity3d.com/Documentation/Manual/AnimationLayers.html
    Btw. which animation do you use? Im currently searching a weapon holding animation.
     
  3. Soumikbhat

    Soumikbhat

    Joined:
    Nov 23, 2013
    Posts:
    110
    I was thinking of using the running animation with the arms holding the gun :p

    Not being able to do it properly, so am also in the same boat as you are
     
  4. KCroxtonJr

    KCroxtonJr

    Joined:
    Nov 29, 2013
    Posts:
    1
    I think this is the same issue I'm dealing with, and am struggling to figure out the solution. I think I've seen a couple of other threads with others having the same issue, and either nobody has the answer or nobody is just replying.

    The issue I'm having is that when I tried to combine two animations, say run (full body animation) and hold weapon (right arm only animation), but instead of the hold weapon animation playing exactly as it should (staying in its keyframed position), the arm seems to rotate along with the chest. I have tried a generic setup, humanoid, I'm pretty sure I properly masked and layered things, but it just will not work as it should. The arm being child of the chest, seems to want to inherit it's parent's rotation when it shouldn't.

    I've tried changing up my rig in many different ways, tried masking things in different ways, layering things in different ways, a ton of different things and I cannot figure it out.

    Is there a bug with overriding animations with layers, or are we just doing something wrong? Would be nice if someone would actually answer this.