Quantcast
Channel: Questions in topic: "ragdoll"
Viewing all articles
Browse latest Browse all 565

How can I make character become a ragdoll with isKinematic?

$
0
0
I've been trying to create a script that makes my Player become a ragdoll when you press the space bar. The Player has a ragdoll with each limb having isKinematic to true. Basically, I want to have it so that if you press the space bar, isKinematic for each limb will be set to false so that they become a ragdoll and the script player script called 'ThirdPersonController' be deactivated. Also, I was trying to have it so that after 5 seconds, the ragdoll resets to the player by activating the 'ThirdPersonController' script and setting isKinematic for the limbs to false. This isn't working as the Limbs remain with isKinematic set to true, but the boolean itself is being activated, so could somebody please help me with my script? I'm quite new to coding. Here is my script: var Limbs : GameObject[]; var IsRagdoll : boolean = false; function Update(){ if(Input.GetKeyDown("space")){ IsRagdoll = true; } } function RagdollActive(){ if(IsRagdoll == true); { Limbs.isKinematic = false; GetComponent(ThirdPersonController).enabled = false; } if(IsRagdoll == false); { Limbs.isKinematic = true; } }

Viewing all articles
Browse latest Browse all 565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>