public void Reset() { if (m_ragdollEnabled) { ragdoll.Remove(); } Destroy(gameObject, 0.0f); }
IEnumerator Restore() { Vector3 estimatedPos = ragdoll.EstimatedSkeletonPosition; Vector3 rbPosition = ragdoll.RootRigidbody.position; Vector3 skeletonPoint = estimatedPos; RaycastHit2D hit = Physics2D.Raycast((Vector2)rbPosition, (Vector2)(estimatedPos - rbPosition), Vector3.Distance(estimatedPos, rbPosition), groundMask); if (hit.collider != null) { skeletonPoint = hit.point; } ragdoll.RootRigidbody.isKinematic = true; ragdoll.SetSkeletonPosition(skeletonPoint); yield return(ragdoll.SmoothMix(0, restoreDuration)); ragdoll.Remove(); AddRigidbody(); }