Example #1
0
        public override void Initialize()
        {
            Debug.Log("Initializing ASAPAgent_UMA " + id);
            AddMecanimToHAnimDefaults();
            if (retarget != null)
            {
                GetBoneList(retarget.transform);
            }
            else if (humanoidRoot != null)
            {
                GetBoneList(humanoidRoot);
            }
            else
            {
                GetBoneList(transform);
            }

            AlignBones();
            AlignCos();
            VJoint[] vJoints = GenerateVJoints();

            List <IFaceTarget> faceTargets = new List <IFaceTarget>();

            faceTargets.Add(new ExpressionPlayerFaceTarget("Surprise",
                                                           new ExpressionControlMapping(new string[] { "midBrowUp_Down", "rightBrowUp_Down", "leftBrowUp_Down", "leftEyeOpen_Close", "rightEyeOpen_Close" },
                                                                                        new float[] { 1.0f, 1.0f, 1.0f, 0.6f, 0.6f })));
            faceTargets.Add(new ExpressionPlayerFaceTarget("Aggressive",
                                                           new ExpressionControlMapping(new string[] { "midBrowUp_Down", "leftLowerLipUp_Down", "rightLowerLipUp_Down", "leftUpperLipUp_Down", "rightUpperLipUp_Down", "jawOpen_Close" },
                                                                                        new float[] { -1.0f, -0.3f, -0.3f, 0.4f, 0.4f, 0.1f })));

            foreach (string target in ExpressionTargetEditor.ExpressionTargets)
            {
                faceTargets.Add(new ExpressionPlayerFaceTarget(target, ExpressionTargetEditor.LoadMapping(target)));
            }

            agentSpec = new AgentSpec(id, vJoints, faceTargets.ToArray());
            Debug.Log("UMA Agent initialized, id=" + this.agentSpec.agentId + " Bones: " + this.agentSpec.skeleton.Length + " faceControls: " + this.agentSpec.faceTargets.Length);

            FindObjectOfType <ASAPManager>().OnAgentInitialized(this);

            if (debug)
            {
                CreateManualAnimationRig();
            }
        }
 public void OnEnable()
 {
     editor           = target as ExpressionTargetEditor;
     showAddTarget    = false;
     showDeleteTarget = false;
 }