Search Unity

Question How to make changeable limbs with Unity and Blender?

Discussion in 'General Discussion' started by shalo1984, Oct 29, 2022.

  1. shalo1984

    shalo1984

    Joined:
    Apr 7, 2021
    Posts:
    2
    I want to make one fantasy creature and a few different arms/legs. The arms/legs can be changed freely in game. Different limbs should have different animation.

    What's the best work flow to achieve it with Unity and Blender? Currently my plan is to:
    1.build main character and limbs in Blender
    2.set up armature and animation to the main character and limbs in Blender
    3.import them to Unity
    4.replace limbs based on rig information. For example, delete the original Arm rig and mesh, then attach new Arm rig and mesh.

    Is it the best way to do it?

    Further, how to handle the seam between the main character and replaced limbs?

    Thank you!
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    The easy way would be using UMA. That's assuming it still works, as it seems it hasn't been updated for some time.
    https://github.com/umasteeringgroup/UMA

    What you describe is rolling out your own system from scratch. It can be done this way, but will take more time.

    Doing it from scratch, there are basically two ways to make something like this happen:
    Either you have invisible "master rig" skeleton with all the bones and several "controlled rigs" which read data from the master skeleton and apply to their own bones...

    Or you build a custom skeletal mesh from all the body parts, and attach it to the master rig. Certainly can be done, but it is much more involved.
     
  3. shalo1984

    shalo1984

    Joined:
    Apr 7, 2021
    Posts:
    2
    Thank you! I just checked the UMA videos briefly. It looks more like changing the apperance of a fixed character. I'm not sure how flexible it is when replacing a limb. For example, changing a human arm to a tentacle.

    For the first method from scratch, I think it's same with what I planned. But I don't know how to handle the seams between body parts.

    For the second method, I don't fully understand how it works. Does the mesh-rig binding process happen in Unity?
     
  4. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    I would use attachment points for doing stuff like swapping and arm for a tentacle. For example a humanoid torso may have a pair of leg attachment points, a pair of arm attachment points, some wings and tail and a head. I would build them all under one file and set up a script to turn the skinned meshes off and on in combos. Getting creative with the UV's can help if yer blending patterns like snake or octopus colors so that in your final meshes the UV's somewhat align to give an illusion of a single organism.The one caveat is yer gonna have to get creative to cover the attachment point joints when rotating them to limits.
     
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    I would make sure, that game animated characters are some form of robots. Robots naturally are made of parts.
    The whole design and animation become now easier, considering parts replacemet feature.
     
  6. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    As far as I know, UMA can't replace a limb with a limb that has a different anatomy (i.e. replace 2 segmented arm with 14 segmented arm).

    In general if you want a creature that has customizable limbs, i.e. where your limb can be an human-like hand with one elbow, or it could be non-human like with 3 segments, or it could be a tentacle that has 10 bones - you're heading into Spore territory and are making your life difficult.

    Unity animator component expects the character to have unchanging bone topology. If each limb can be vastly different depending on object configuration, it means you can no longer make one animation and forget about it, you'd need to create some sort of syste to correctly drive character limbs, no matter what those limbs are.

    If you're new and are just starting out, I'd suggest to reconsider.

    On other hand, if you're doing it for fun, this sort of exercise can make you learn a lot about unity.
     
  7. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    As far as I know, UMA can't replace a limb with a limb that has a different anatomy (i.e. replace 2 segmented arm with 14 segmented arm).

    You can replace a limb. I have replaced hands and head. We are working on some replaceable limbs for our UMA characters. You might have to accept it working differently. We are in the middle of a game but will see if we can some of the replaceable limbs and show them off to you.
     
  8. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    You don't have to.

    I was talking about situation where anatomy of a new limb is radically different. Tentacle instead of an arm, for example, with the tentacle no longer fitting into humanoid avatar and has 14 bones instead of "upperarm"/"lowerarm"/"hand" and optional fingers.
     
  9. Nebulaoblivion

    Nebulaoblivion

    Joined:
    Dec 9, 2017
    Posts:
    8
    Doesn't sound too difficult, just have to model your characters somewhat modularly, keep your default arms in the same blend file but as separate objects. Then make new blend files for the alternate limbs with their wacky skeletons and parent those to the bones they'd be coming off of in unity.
    and then do something along the lines of this pseudocode.
    Code (CSharp):
    1. [SerializeField]
    2. GameObject normalArm, tentacleArm;
    3.  
    4. private void Start()
    5.  
    6. {
    7.      normalArm.SetActive(true);
    8.      tentacleArm.SetActive(false);
    9. }
    10.  
    11.  
    12. private void Update()
    13. {
    14.  
    15.     if(someInput == true)
    16.        {
    17.             normalArm.SetActive(false);
    18.             tentacleArm.SetActive(true);
    19.        }
    20. }

    You can get fancier with transitioning the arm by scaling it up or something. You'll need two animators to handle the different skeletons for the different limbs of course.

    As for hiding the seams, I'd try to do it with clothes/armor, or big tufts of fur or something.