AvatarBuilder and Humanoid RuntimeAnimationController

Hi,

I’m importing a 3d model into a skinned mesh renderer and transform hiearachy at runtime. I’m then trying to create a human avatar using the avatar builder. This all works fine. However, when i then set the runtime animation controller(which uses animations set to human) on the animator component the model goes straight into the muscle setup pose. Am i missing something ? I’ve got FinalIK running on the gameobject and all the transforms and mesh deforming work fine using IK, so i can only assume the boneweights are correct. The bindposes are set using a t-pose at import. The animation controller works fine on other models that have been imported during build-time.

The code to create the avatar is as follows(this runs without throwing any exceptions and the avatar has isHuman set to true):

     Avatar av = null;     

        HumanDescription hd = RigBoneMapping.getHumanDescription(bonesList.ToList(), RigBoneMapping.BoneMapping.Biped);
       
        hd.armStretch = 0.5f;
        hd.feetSpacing = 0.5f;
        hd.legStretch = 0.5f;
        hd.lowerArmTwist = 0.5f;
        hd.lowerLegTwist = 0.5f;
        hd.upperArmTwist = 0.5f;
        hd.upperLegTwist = 0.5f;
        //hd.hasTranslationDoF = true;

        av = AvatarBuilder.BuildHumanAvatar(bonesList[0].gameObject, hd);

        bonesList[0].parent = armature.transform;

        Animator ar = rootObj.AddComponent<Animator>();

        ar.enabled = false;

        av.name = "AvatarX";

        ar.avatar = av;
        ar.applyRootMotion = true;
        //  ar.runtimeAnimatorController = bipedIdle;       

        ar.enabled = true;

Hey, @ I know this is basically a dead thread but I’m trying to do the same thing with a runtime imported rigged model + Final IK (without playing animations from a controller) and it seems you got that part working. Your code is a good starting point, but can you give me a little more info? What is RigBoneMapping? BonesList?

Is there any other code you can share if you still have this project? Thanks!