コード例 #1
0
        public void Transform()
        {
            if (!IsEnable || Target == null || IKLinksBones.Length == 0)
                return;
            InitializeAngle();
            CalcBonePosition(IKLinksBones.Length - 1);
            _ikPosition = IK.GetTransformedBonePosition();
            Target.UpdateLocalMatrix();
            _targetPosition = Target.GetTransformedBonePosition();
            
            if ((_ikPosition - _targetPosition).LengthSquared < 1E-08f)
                return;

            int num = LoopCount / 2;
            for (int i = 0; i < LoopCount; i++)
            {
                for (int j = 0; j < IKLinksBones.Length; j++)
                {
                    if (!_fixAxis[j])
                    {
                        IKProc_Link(j, i < num);
                    }
                }
                if ((_ikPosition - _targetPosition).LengthSquared < 1E-08f)
                    break;
            }
        }