Ragdoll spazzes out.

Ok, so i have my ragdoll being instantiated at the player rotation and position when it collides with some electricity that comes out of my enemy, but when i do so the ragdoll goes crazy. goes into the floor and flails around. I am postion two images, one that shows the ragdoll components and one that shows it ones it’s instantiated.


I’ll show you the code as well

#pragma strict
var enableGUI : boolean = false;
static var beenKilled : boolean = false;
private var respawnPoint : Transform;
private var player : Transform; 
var ragDoll : Transform;
var playerReplacement : Transform;

function Start () {

 respawnPoint = GameObject.FindWithTag("respawnPoint").transform;	
 player = GameObject.FindWithTag("Player").transform; 
		yield WaitForSeconds(4);
function OnTriggerEnter (hitPlayer : Collider) {
	if(hitPlayer.gameObject.tag == "Player") {
		var deadBody = Instantiate(ragDoll, player.transform.position, player.transform.rotation);
		Debug.Log("ragdoll instantiated");
		yield WaitForSeconds(1);
		enableGUI = true;
		beenKilled = true;

function OnGUI () {
	if(enableGUI == true) {
			Time.timeScale = 0;
			GUILayout.BeginArea( Rect(Screen.width/2, Screen.height/2, 200, 200) );
				GUILayout.Label("You Got Killed");
				if(GUILayout.Button("Continue")) {

					if(beenKilled == true) {
						enableGUI = false;
						Time.timeScale = 1;
						Instantiate(playerReplacement, respawnPoint.transform.position, respawnPoint.transform.rotation);
				if(GUILayout.Button("Go To Main Menu")) {
					Time.timeScale = 1;

This usually happens when ragdoll colliders are “immersed” in another collider which has a rigidbody attached.

Usually you have this when:

  1. the ragdoll colliders intersect eachother because they’re too big.
  2. the physics matrix is not properly set, and so for example the ragdoll parts intersect the character controller or some other collider that encapsulates them.

The fix normally consists of making the ‘super’ collider a ‘Trigger’, so that it doesn’t act as a physical object.