I have this code inside a script:
function Die() {
print("Dying");
animation.Stop();
Destroy(GetComponent(CapsuleCollider));
Destroy(GetComponent(Rigidbody));
var rigidbodies = gameObject.GetComponentsInChildren (Rigidbody);
for (var currentBody : Rigidbody in rigidbodies) {
currentBody.isKinematic = false;
}
}
In the beginning, I have a similar piece of code that sets all rigidbodies to be kinematic. Now when this code is run, I would expect the object in question to turn into a ragdoll. But instead, it stand in the pose the animation left it in and jerks about once a second. Can someone tell me the problem here?[/code]