Transferring mechanical rigs from blender to unity

I'm in the process of learning how to rig characters and I am curious if mechanical rigs will transfer from blender to unity? I know that you can not transfer particle systems from blender to unity and if I had know that before I started learning about them, I would have skipped right into learning how to make particle systems in unity rather than blender. I am trying to avoid a similar mistake this time. Aside from mechanical rigs, are there any other things that do not transfer from blender to unity? Thanks for your help!

  • Jonathan Gonzalez(jgonzalez) replied

    Generic rigs can transfer over to Unity, but generic rigs tend to be quite varied. There are plenty of things that won't transfer over to Unity such as constraints and special modifiers. If it's just a series of bones connected together then it should be fine, but if it has a complex setup in Blender then it may not transfer over well. I would just suggest trying it out at first. 

  • Hunter & Tiff Eidmann(eithman) replied

    I have run into my first limitation while playing with inverse kinematics. I built a simple leg and added a basic bone rig to it. Then I added an additional bone to use as the target for the IK bone constraint. I remembered you saying that some constraints did not work when exported to unity so when I was at this part of the tutorial I thought I would export it to Unity to test it. Once in unity the skeleton within the leg mesh works fine but the IK target bone does nothing as expected. I then found your tutorial on the basics of IK in unity which helped a lot! Now I am wondering if there are any other tutorials on CG that go into more advanced parts of IK or do your videos pretty much cover everything there is to know about it? 


    Also the rigify addon was extremely helpful! Is there anything similar to that within Unity that you are aware of? Or any other assets that simplify the IK process?

  • Hunter & Tiff Eidmann(eithman) replied

    After looking around for a while it seems to me that unity does not offer much when it comes to rigging with constraints. All the tutorials are within blender and since these constraints do not transfer to unity, they  do not seem to be of much use if you are building a game within unity. Is my only option to rig meshes with constraints inside of blender, animate them inside of blender and then export that to unity? Or is there a way to do these same types of constraints within Unity? Thank you for all your help!

  • Jonathan Gonzalez(jgonzalez) replied

    I do cover IK in a few different tutorials, I can pull them up. I think most of the IK stuff I teach is within Live streams so I can link those when I find them and give you times when it is discussed in those streams. I would venture to say that most if not all constraints in Blender will not work. I'm not an expert in using Blender animations, but I believe you can "bake" stuff like that into animations then bring that into Unity.

     It just depends what you're using IK for. General IK is far more complex than humanoid IK. It can be done with generic rigs, but with humanoid rigs Unity does most of the heavy lifting for you. With generic rigs you essentially need to build an entire IK system from scratch since Unity has no idea how those rigs are supposed to operate. 

  • Hunter & Tiff Eidmann(eithman) replied

    Those links will be extremely helpful, thank you so much! Do you know if they cover how to build an IK system for general rigs? 

    Also, I was looking around the asset store and came across the Skele Animation tool. Do you have any experience with that? It offers constraints and IK along with a lot of other things. But it seems like it might be pretty specific to humanoid shapes. If not no worries, I was just curious :)

  • Jonathan Gonzalez(jgonzalez) replied

    For general rigs this is a good place to start: Robot Arms IK I haven't built general IK myself so I don't have experience with it. I've never used that tool you mentioned, but if I had to recommend IK assets I would recommend those from Root Motion; Final IK and Puppet Master. I have both of these and they are fantastic. I'm actually using them with a character for a fighting game. Final IK is great for all sorts of IK purposes, and puppet master is great for things like playing animations and getting "live ragdolls". So in a fighting game where you want realistic impacts while playing animations. 

  • Jonathan Gonzalez(jgonzalez) replied

    Looking through the streams I noticed I did use IK but I didn't really cover it much outside of setting up a few Animation layers and enabling IK but I can provide the script I use often for humanoid IK:


    using UnityEngine;
    using System.Collections;

    //add IK to the first layer in the Animator controller and add a second layer with IK enabled to control the arms

    public class AimIK : MonoBehaviour
    {
    [Header ("IK Transform References")]

    public Transform ikReference = null;
    public Transform leftHandle = null;
    public Transform rightHandle = null;

    private Vector3 target;
    private Animator animator;

    [Header("IK Weight Values")]
    [Range(0,1)]
    public float aimWeight;
    public float aimAdjustment, bodyWeight, headWeight, eyesWeight, clampWeight;

    // Use this for initialization
    void Start ()
    {
    animator = GetComponent<Animator> ();



    }

    void OnAnimatorIK ()
    {
            target = ikReference.position;
    target.y = target.y + aimAdjustment;
    animator.SetLookAtPosition (target);
    animator.SetLookAtWeight (aimWeight, bodyWeight, headWeight, eyesWeight, clampWeight);


    if (leftHandle != null) {
    animator.SetIKPosition (AvatarIKGoal.LeftHand, leftHandle.transform.position);
    animator.SetIKRotation (AvatarIKGoal.LeftHand, leftHandle.transform.rotation);
    animator.SetIKPositionWeight (AvatarIKGoal.LeftHand, aimWeight);
    animator.SetIKRotationWeight (AvatarIKGoal.LeftHand, aimWeight);
    }

    if (rightHandle != null) {
    animator.SetIKPosition (AvatarIKGoal.RightHand, rightHandle.transform.position);
    animator.SetIKRotation (AvatarIKGoal.RightHand, rightHandle.transform.rotation);
    animator.SetIKPositionWeight (AvatarIKGoal.RightHand, aimWeight);
    animator.SetIKRotationWeight (AvatarIKGoal.RightHand, aimWeight);
    }
    }

    }



    This was used for this robot character: Robot Controller IK. It's the same script I use when I need generic IK for humanoid characters. It allows you to use a target for the character to follow and has a few sliders for adjusting the view so if it's too high or too low you can tweak it. It also has transforms to be used as handles on the hands. This will allow you to use IK on the hands to move the arms around and place them into a different pose. 

    In order to use this make sure you apply this script to the object that has the Animator component. In the animator controller you may need to create a second layer and enabled IK, also set the layer weight to 1. This may not be needed anymore, but before this was the process of getting IK to work. 

    Then just assign transforms for the target (ikReference) which will be used to have the player look in a specific direction. The handles are for the hands, so place these near the hands. You can then play the scene and make adjustments to the IK as needed. It'll require going back and forth a lot. When you've made changes to one of the handles or target you can copy the transform component then get out of player mode and paste those values in.