All Classes Namespaces Functions Variables Enumerations Properties Pages
Creating Ragdolls

BipedRagdollCreator
PuppetMaster contains a very easy to use visual ragdoll creation tool for biped characters (can actually be used on any character with at least 4 limbs) called BipedRagdollCreator. When the BipedRagdollCreator.cs component is enabled on a character, the ragdoll components will be destroyed and recreated each time you change the references or options. This enables for fast and intuitive live editing.

Getting started

Component variables:

BipedRagdollCreator2.png

Creating ragdolls in runtime:

[Tooltip("The character prefab/FBX.")]
public GameObject prefab;
void Start() {
// Instantiate the character
GameObject instance = GameObject.Instantiate(prefab);
// Find bones (Humanoids)
BipedRagdollReferences r = BipedRagdollReferences.FromAvatar(instance.GetComponent<Animator>());
// How would you like your ragdoll?
BipedRagdollCreator.Options options = BipedRagdollCreator.AutodetectOptions(r);
// Edit options here if you need to
//options.headCollider = RagdollCreator.ColliderType.Box;
//options.weight *= 2f;
//options.joints = RagdollCreator.JointType.Character;
// Create the ragdoll
BipedRagdollCreator.Create(r, options);
Debug.Log("A ragdoll was successfully created.");
}
void Update() {
// If bone proportions have changed, just clear and recreate:
//BipedRagdollCreator.ClearBipedRagdoll(r); //ClearAll if you have changed references
//BipedRagdollCreator.Create(r, options);
}