function OnTriggerEnter (other : Collider) {
// are is the collider heading in the direction of the person 0.5 is arbitrary, it may require more or less
if(Vector3.Dot(collider.rigidbody.velocity, transform.position)>0.5){
// create a hit and see how close the actual hit point is.
var hit : RaycastHit;
if(Physics.Linecast(transform.position, collider.transform.position, hit)){
// are we less than 1 frame from hitting the person?
if(collider.rigidbody.velocity.magnitude * Time.deltaTime / Vector3.Distance(transform.position, hit.point)<1){
//We are about to hit…
//cycle through the armature and convert the character to a rag doll
}
}
}
}
Ok i have this script now i need to make this://cycle through the armature and convert the character to a rag doll any help, tnx in advance…