Search Unity

Question Unify Attach Weapon

Discussion in 'Animation' started by Atsutake, Apr 11, 2023.

  1. Atsutake

    Atsutake

    Joined:
    Mar 8, 2023
    Posts:
    18
    Hello all,

    I would like to unify the attach of weapon to avatar i.e. on right hand. SInce now I worked with mixamo characters and humanoid animated avatars. But then I tried to attach on non-mixamo characters like:

    https://assetstore.unity.com/packages/3d/characters/creatures/dungeon-skeletons-demo-71087

    Then I seperated the skeleton weapon, because of weapon controller. Now the rotation of weapon and the bone its attached are both different from mixamo model&weapon. That way I wouldn't be able to use the skeleton weapon on mixamo model unless i do re-rotation i.e. on all that are non-mixamo.

    Is the issue related to that the skeleton does not use humanoid avatar? Or is there a unified solution?
     
  2. Noodle_Meanie

    Noodle_Meanie

    Joined:
    Sep 11, 2021
    Posts:
    110
    Sorry I'm not exactly sure what you mean, mostly because the things I develop are different, but I do know that if you were to take the weapon (in unity), and put in the position you wanted on your character, then parent the weapon to your characters arm, it would always be at that point on your characters arm, and rotate with it.

    Other wise, if your character is all one game object, then you can parent the sword to your character, and then add its movements to your animation. If you wanted to also change the appearance of the weapon, use another animator that's on the weapon itself.

    I'm really sorry if this isn't what you wanted or not helpful at all. I haven't done anything with mixamo yet.
     
  3. Atsutake

    Atsutake

    Joined:
    Mar 8, 2023
    Posts:
    18
    I do attach weapon to right/left hand bone it does stay there and takes rotation of bone (its transform). But my issue is rather that i need some kind of convention. Like the right hand's rotation of mixamo model is different compared to some other models from asset store (check skeleton link above). goblin right hand.JPG
    skeleton right hand.JPG
    When i seperate a weapon from mixamo model i.e. by 3D Editor (Blender) and then attach in unity, everything is fine.
    goblin sword.JPG
    But when you crossover a mixamo weapon onto the skeleton model (which is generic and not humanoid animated avatar) or vice versa, then it does not look like the skeleton/model wears the weapon in right orientation (sword heading is different). The reason for this is that the skeleton right hand bone/transform is not rotated as mixamo models right hand. They seem to have different "conventions"?
    goblin bad sword.JPG
    And it would be quite a hassle to re-rotate or not depending on if it is an mixamo model or not. Another idea might be to use additional transform inbetween right hand and weapon, but this would also mean i would have to do this for any combination of model and equipment.

    Now the question is how to solve this, so it doesn't matter which model wears what weapon? I guess there is no simple way to unify the rigs of goblin & skeleton?

    Btw: My characters and weapons have seperate prefabs, the attaching is done like in any RPG by equipping your gear from inventory.

    Edit: Was able to solve it. Just use align empty gameobject on character hand/bone to individualize and unify all weapon models to be equally aligned.
     
    Last edited: Apr 18, 2023