Beispiel #1
0
        //여기서는 LinkBoneChaining만 진행
        /// <summary>
        /// Bone Chaining 직후에 재귀적으로 호출한다.
        /// Tail이 가지는 -> Head로의 IK 리스트를 만든다.
        ///
        /// </summary>
        public void LinkBoneChaining()
        {
            if (_localMatrix == null)
            {
                _localMatrix = new apMatrix();
            }
            if (_worldMatrix == null)
            {
                _worldMatrix = new apMatrix();
            }
            if (_worldMatrix_NonModified == null)
            {
                _worldMatrix_NonModified = new apMatrix();
            }


            if (_isIKTail)
            {
                apOptBone curParentBone = _parentBone;
                apOptBone headBone      = _IKHeaderBone;

                bool isParentExist       = (curParentBone != null);
                bool isHeaderExist       = (headBone != null);
                bool isHeaderIsInParents = false;
                if (isParentExist && isHeaderExist)
                {
                    isHeaderIsInParents = (GetParentRecursive(headBone._uniqueID) != null);
                }


                if (isParentExist && isHeaderExist && isHeaderIsInParents)
                {
                    if (_IKChainSet == null)
                    {
                        _IKChainSet = new apOptBoneIKChainSet(this);
                    }
                    //Chain을 Refresh한다.
                    _IKChainSet.RefreshChain();
                }
                else
                {
                    _IKChainSet = null;

                    Debug.LogError("[" + transform.name + "] IK Chaining Error : Parent -> Chain List 연결시 데이터가 누락되었다. "
                                   + "[ Parent : " + isParentExist
                                   + " / Header : " + isHeaderExist
                                   + " / IsHeader Is In Parent : " + isHeaderIsInParents + " ]");
                }
            }
            else
            {
                _IKChainSet = null;
            }

            if (_childBones != null)
            {
                for (int i = 0; i < _childBones.Length; i++)
                {
                    _childBones[i].LinkBoneChaining();
                }
            }
        }