/* * * actually add the rigidbody, collider, joint components that make up the ragdoll (if add components) * * measure the initial head offset from chest */ public static void BuildBones(Animator animator, RagdollProfile profile, bool addComponents, Dictionary <HumanBodyBones, RagdollTransform> boneElements, out float initialHeadOffsetFromChest) { if (addComponents) { EraseRagdoll(animator); //add capsules BuildCapsules(boneElements); AddBreastColliders(boneElements); AddHeadCollider(boneElements); //add rigidbodies BuildRigidodies(boneElements); //add joints BuildJoints(boneElements); //add bone components BuildBones(boneElements); } //initial head position from chest (used for resizing chest collider based on head offset) initialHeadOffsetFromChest = boneElements[HumanBodyBones.Chest].transform.InverseTransformPoint(boneElements[HumanBodyBones.Head].transform.position).y; // update the ragdoll to reflect it's profile values Ragdoll.UpdateBonesToProfileValues(boneElements, profile, initialHeadOffsetFromChest); }