UnityEditor.RagdollBuilder.BuildJoints C# (CSharp) Method

BuildJoints() private method

private BuildJoints ( ) : void
return void
        private void BuildJoints()
        {
            IEnumerator enumerator = this.bones.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    BoneInfo current = (BoneInfo) enumerator.Current;
                    if (current.parent != null)
                    {
                        CharacterJoint joint = current.anchor.gameObject.AddComponent<CharacterJoint>();
                        current.joint = joint;
                        joint.axis = CalculateDirectionAxis(current.anchor.InverseTransformDirection(current.axis));
                        joint.swingAxis = CalculateDirectionAxis(current.anchor.InverseTransformDirection(current.normalAxis));
                        joint.anchor = Vector3.zero;
                        joint.connectedBody = current.parent.anchor.GetComponent<Rigidbody>();
                        joint.enablePreprocessing = false;
                        SoftJointLimit limit = new SoftJointLimit {
                            contactDistance = 0f,
                            limit = current.minLimit
                        };
                        joint.lowTwistLimit = limit;
                        limit.limit = current.maxLimit;
                        joint.highTwistLimit = limit;
                        limit.limit = current.swingLimit;
                        joint.swing1Limit = limit;
                        limit.limit = 0f;
                        joint.swing2Limit = limit;
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }