public void DismemberBone(string reason, Ragdoll ragdoll, RagdollTransform bone) { InitializeDismemberedBones(); if (!dismembermentAvailable) { return; } if (!BoneDismemberable(bone.bone.bone)) { return; } if (RagdollPhysics.RigidbodyGrabbed(bone.rigidbody)) { return; } // Debug.LogError("Dismembered " + reason); dismemberedBones[bone.bone.bone] = bone; // dismember the follow target, so it reflects our dismemberment // (dismembers the animated model...) if (bone.followTarget != null) { DismemberBone(ragdoll, bone.followTarget, true); } // dismember and disable any child bones (helps physics from getting all jittery) HumanBodyBones childBone = Ragdoll.GetChildBone(bone.bone.bone); RagdollTransform childBoneTransform = ragdoll.GetBone(childBone); if (!BoneDismembered(childBoneTransform)) { DismemberBone(reason, ragdoll, childBoneTransform); } ragdoll.StartCoroutine(DismemberBoneDelayed(ragdoll, bone)); }
public bool RigidbodyGrabbed() { return(RagdollPhysics.RigidbodyGrabbed(rigidbody)); }