function DisableRagdoll() {
var rb:Rigidbody;
for (rb in GetComponentsInChildren(Rigidbody)) {
rb.enabled = false;
}
}
I would like to help but I am a beginner and not that good with JavaScript.
I’ll give it a go nonetheless.
I just need to know exactly what you’re trying to do with (rb in GetComponentsInChildren(Rigidbody)) because I have no idea what the “in” represents.
I’ve read that you can’t disable/enabled rigidbody, you can only delete/add them or put them to sleep.
For now, I only have this, but I can’t verify it :
void DisableRagdoll() {
private Rigidbody rb; //I don't think it's the best idea to put that here. I would put that outside of any function (void). I'm not sure, thought. Just a feeling.
for (rb in GetComponentsInChildren<Rigidbody>) { //I don't know about "rb in"
rb.Sleep();
}
}
OR
void DisableRagdoll() {
private Rigidbody rb;
for (rb in GetComponentsInChildren<Rigidbody>) {
Destroy(rb);
}
}
Tell me if it helps
I’m learning and would like to know if the “solutions” I’m coming up with work.