Exemple #1
0
        public void Initialize()
        {
            if (target == null || transformCount == 0 || IKUtility.GetAncestorCount(target) < transformCount - 1)
            {
                return;
            }

            m_Transforms            = new Transform[transformCount];
            m_DefaultLocalRotations = new Quaternion[transformCount];
            m_StoredLocalRotations  = new Quaternion[transformCount];

            var currentTransform = target;
            int index            = transformCount - 1;

            while (currentTransform && index >= 0)
            {
                m_Transforms[index]            = currentTransform;
                m_DefaultLocalRotations[index] = currentTransform.localRotation;

                currentTransform = currentTransform.parent;
                --index;
            }
        }
Exemple #2
0
 private bool Validate()
 {
     if (target == null)
     {
         return(false);
     }
     if (transformCount == 0)
     {
         return(false);
     }
     if (m_Transforms == null || m_Transforms.Length != transformCount)
     {
         return(false);
     }
     if (m_DefaultLocalRotations == null || m_DefaultLocalRotations.Length != transformCount)
     {
         return(false);
     }
     if (m_StoredLocalRotations == null || m_StoredLocalRotations.Length != transformCount)
     {
         return(false);
     }
     if (rootTransform == null)
     {
         return(false);
     }
     if (lastTransform != target)
     {
         return(false);
     }
     if (effector && IKUtility.IsDescendentOf(effector, rootTransform))
     {
         return(false);
     }
     return(true);
 }
Exemple #3
0
 protected override void DoInitialize()
 {
     m_Chain.transformCount = m_Chain.effector == null || IKUtility.GetAncestorCount(m_Chain.effector) < 2 ? 0 : 3;
     base.DoInitialize();
 }