Ejemplo n.º 1
0
        /// <summary>
        /// Automatically build the chain
        /// </summary>
        /// <param name="anim"></param>
        public void AutoBuild(Animator anim)
        {
            if (anim == null)
            {
                Debug.LogError("The Animator component passed is NULL");
                return;
            }

            RigReader rigReader = new RigReader(anim);

            switch (LegType)
            {
            case HumanLegs.RightLeg:
                var tempR = rigReader.BuildChain(LegType);
                Chain.Joints = tempR.Joints;
                break;

            case HumanLegs.LeftLeg:
                var tempL = rigReader.BuildChain(LegType);
                Chain.Joints = tempL.Joints;
                break;
            }

            Init();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Detect and initiate the rig
 /// </summary>
 public void DetectRig()
 {
     if (!animator)
     {
         animator = GetComponent <Animator>();
     }
     rigReader = new RigReader(animator);
 }
        /// <summary>
        /// Automatically Initialise the references
        /// </summary>
        private void AutomaticInit()
        {
            if (SourceAnimator.isHuman == false)
            {
                Debug.LogError(this + " works only for humanoid characters");
                enabled = false;
                return;
            }

            RigReader rigReader = new RigReader(SourceAnimator);

            if (Root == null)
            {
                Root = rigReader.Root.joint;
            }

            //auto build the chains
            Right.AutoBuild(SourceAnimator);
            Left.AutoBuild(SourceAnimator);
        }