Ragdoll Bone Physics system [OPEN SOURCE]

but can be used for any rigidbodies. decided to make this opensource

make a ragdoll, you’ll have the character joints (bones) with rigidbody weights

I found it to be for 100 rigidbody mass 980 is the force up which keeps it up in air
Im using AddRelativeForce with my controller, so it might be different
hopefully something will be added along the way

//forcebutton.js
var chestjoint : Transform;
var hipjoint : Transform;
var rShoulder : Transform;
var lShoulder : Transform;
var lHand : Transform;
var rHand : Transform;
var lFoot : Transform;
var rFoot : Transform;

var forceup : int = 1000;
var forcefwd : int = 1000;

var forcelHandY : int = 0;
var forcelHandZ : int = 0;
var forcelHandX : int = 0;

var forcerHandY : int = 0;
var forcerHandZ : int = 0;
var forcerHandX : int = 0;

var FrShoulderX : int = 0;
var FrShoulderY : int = 0;
var FrShoulderZ : int = 0;

var FlShoulderX : int = 0;
var FlShoulderY : int = 0;
var FlShoulderZ : int = 0;

var FlFootX : int = 0;
var FlFootY : int = 0;
var FlFootZ : int = 0;

var FrFootX : int = 0;
var FrFootY : int = 0;
var FrFootZ : int = 0;


function Start () {
}

function FixedUpdate () {

chestjoint.rigidbody.AddForce (0, forceup, 0);

if(hipjoint!=null) hipjoint.rigidbody.AddForce (0, 0, forcefwd);

if(rHand!=null)rHand.rigidbody.AddForce (forcerHandX, forcerHandY, forcerHandZ);
if(rShoulder!=null)rShoulder.rigidbody.AddForce (FrShoulderX, FrShoulderY, FrShoulderZ);
if(lHand!=null) lHand.rigidbody.AddForce (forcelHandX, forcelHandY, forcelHandZ);
if(lShoulder!=null)lShoulder.rigidbody.AddForce (FlShoulderX, FlShoulderY, FlShoulderZ);

if(rFoot!=null)rFoot.rigidbody.AddForce (FrFootX, FrFootY, FrFootZ);
if(lFoot!=null)lFoot.rigidbody.AddForce (FlFootX, FlFootY, FlFootZ);

}

ok. I took this a step further.

I think its good to call addforce in functions in this.
mass of bones
hip 20 chest 15 limbs 10-10 head 5

FORCE UP : 900

the groundanchor is a rigidbody weight too.

var chestjoint : Transform;
var hipjoint : Transform;

var rShoulder : Transform;
var lShoulder : Transform;
var lHand : Transform;
var rHand : Transform;
var lFoot : Transform;
var rFoot : Transform;

var Head : Transform;
var ground : Transform;
var groundanchor : GameObject;

var forceup : int = 940;
var forcefwd : int = 0;

var FchestjointX : int = 0;
var FchestjointY : int = 0;
var FchestjointZ : int = 0;

var FhipjointX : int = 0;
var FhipjointY : int = 0;
var FhipjointZ : int = 0;

var FrShoulderX : int = 0;
var FrShoulderY : int = 0;
var FrShoulderZ : int = 0;

var FrHandY : int = 0;
var FrHandZ : int = 0;
var FrHandX : int = 0;

var FlShoulderX : int = 0;
var FlShoulderY : int = 0;
var FlShoulderZ : int = 0;

var FlHandY : int = 0;
var FlHandZ : int = 0;
var FlHandX : int = 0;

var FlFootX : int = 0;
var FlFootY : int = 0;
var FlFootZ : int = 0;

var FrFootX : int = 0;
var FrFootY : int = 0;
var FrFootZ : int = 0;

var FHeadY : int = 100;
var FHeadZ : int = 0;
var FHeadX : int = 0;

var guiforce : GUIText;
var guiground : GUIText;
var standin : boolean;
var inair : boolean;

function Start () {
groundanchor.active = true;
}

function FixedUpdate () {

Time.timeScale = 1;


if(hipjoint!=null){
//hipjoint.rigidbody.freezeRotation = true;
if(hipjoint.rigidbody.velocity.magnitude > 0.01){
hipjoint.rigidbody.AddRelativeForce (-hipjoint.rigidbody.velocity.magnitude/2, 0, -hipjoint.rigidbody.velocity.magnitude/2);
groundanchor.active = true;
}
if(hipjoint.rigidbody.velocity.magnitude < -0.01){
hipjoint.rigidbody.AddRelativeForce (-hipjoint.rigidbody.velocity.magnitude/2, 0, -hipjoint.rigidbody.velocity.magnitude/2);
groundanchor.active = true;
}

}


//UP
//keyboard

if(Input.GetKey("0")){
chestjoint.rigidbody.AddForce (0, 1000, 0);
forcefwd += 100;
}

//KICKS
//keyboard
if (Input.GetKey("1")){
rFootKick();
}

if (Input.GetKey("2")){
lFootKick();
}

//KNOCKS
//rHand move1
if (Input.GetKey("3")){
rKnock();
}
//rHand KNOCK move2
if (Input.GetKey("4")){
lKnock();
}

//ROTATE
if (Input.GetKey("5")){
Rotate();
}

if (Input.GetKey("6")){
ForceUp();
}

if (Input.GetKey("7")){
StandUp();
}

//CHECK GROUND BELOW
	var hit : RaycastHit;
	var direction = Vector3(0,-1,0);
if(Physics.Raycast(ground.transform.position, direction, hit, 1)){
//print("raycasthit");
if(hit.distance < 0.16){
//print("raycasthit1");
//chestjoint.rigidbody.AddForce (0, forceup/1.2, 0);
//hipjoint.rigidbody.AddForce (0, forceup/2.5, 0);
standin = true;
inair = false;
guiground.text = "GROUND"; 
}else{
standin = false;
inair = true;
guiground.text = ""; 
forceup = 0;
}
}else{
standin = false;
inair = true;
guiground.text = ""; 

forceup -= 100;
//forceup = 0;
}

chestjoint.rigidbody.AddForce (0, forceup, forcefwd);


//ADD FORCE 
guiforce.text = "  FORCEUP: " + forceup + "chUP: " + FchestjointY + "hUP: " + FhipjointY;

chestjoint.rigidbody.AddRelativeForce (FchestjointX, FchestjointY, FchestjointZ);

if(hipjoint!=null) hipjoint.rigidbody.AddRelativeForce (FhipjointX, FhipjointY, FhipjointZ);
if(rHand!=null)rHand.rigidbody.AddRelativeForce (FrHandX, FrHandY, FrHandZ);
if(rShoulder!=null)rShoulder.rigidbody.AddRelative  Force (FrShoulderX, FrShoulderY, FrShoulderZ);
if(lHand!=null) lHand.rigidbody.AddRelativeForce (FlHandX, FlHandY, FlHandZ);
if(lShoulder!=null)lShoulder.rigidbody.AddRelative  Force (FlShoulderX, FlShoulderY, FlShoulderZ);

if(rFoot!=null)rFoot.rigidbody.AddRelativeForce (FrFootX, FrFootY, FrFootZ);
if(lFoot!=null)lFoot.rigidbody.AddRelativeForce (FlFootX, FlFootY, FlFootZ);

if(Head!=null)Head.rigidbody.AddRelativeForce (FHeadX, FHeadY, FHeadZ);

NoForce();

}

function rFootKick(){
FrFootY += 100;
FrFootZ += 100;
FchestjointY -= 50;
FhipjointY -= 100;
forceup = 500;
forcefwd -= 25;
groundanchor.active = true;
}

function lFootKick(){
FlFootY += 200;
FlFootZ += 150;
FhipjointZ -= 3;
FhipjointY -= 100;
FchestjointZ += 5;
}

function Rotate(){
chestjoint.rigidbody.AddRelativeTorque (0, 200, 0);
hipjoint.rigidbody.AddRelativeTorque (0, -50, 0);
}

function rKnock(){
FrHandX += 150;
FrHandY += 60;
FrHandZ += 100;
FrShoulderX -= 50;

forcefwd -= 30;
FchestjointZ = 0;
FchestjointY += 80;
FchestjointZ -= 10;
FhipjointY += 80;
}

function lKnock(){
//rShoulder.rigidbody.AddRelativeTorque (0, 5000, 0);

FrHandZ += 150;
forcefwd -= 30;
FchestjointZ = 0;
FchestjointY -= 40;
FchestjointZ -= 10;
FhipjointY -= 180;
}

function ForceUp(){
//print("forceup");
chestjoint.rigidbody.AddForce (0, 800, 0);
}

function StandUp(){

forceup += 500;
FchestjointY += 500;


}


function NoForce(){

yield WaitForSeconds(0.5);
if(standin == true) forceup = 950;
if(standin == false) forceup = 960;
forcefwd = 0;

FchestjointX = 0;
FchestjointY = 0;
FchestjointZ = 0;

FhipjointX = 0;
FhipjointY = 0;
FhipjointZ = 0;

FlHandY = 0;
FlHandZ = 0;
FlHandX = 0;

FrHandY = 0;
FrHandZ = 0;
FrHandX = 0;

FrShoulderX = 0;
FrShoulderY = 0;
FrShoulderZ = 0;

FlShoulderX = 0;
FlShoulderY = 0;
FlShoulderZ = 0;

FlFootX = 0;
FlFootY = 0;
FlFootZ = 0;

FrFootX = 0;
FrFootY = 0;
FrFootZ = 0;

FHeadX = 0;
FHeadY = 150;
FHeadZ = 80;

standin = true;
//groundanchor.active = false;

}