26 lines
522 B
C#
26 lines
522 B
C#
using Sirenix.OdinInspector;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class RagdollComponent : MonoBehaviour
|
|
{
|
|
[Button]
|
|
public void Ragdoll()
|
|
{
|
|
var rigidBodies = GetComponentsInChildren<Rigidbody>();
|
|
|
|
foreach (var rb in rigidBodies)
|
|
{
|
|
rb.isKinematic = false;
|
|
}
|
|
|
|
var animators = GetComponentsInChildren<Animator>();
|
|
|
|
foreach (var a in animators)
|
|
{
|
|
a.enabled = false;
|
|
}
|
|
}
|
|
}
|