Applying Ragdoll physics to a character
Action games often make use of Ragdoll physics to simulate the character's body's reaction to being affected by a hit or explosion. In this recipe, we will learn how to set up and activate Ragdoll physics for our character whenever she touches a spiky object. We will also use the opportunity to reset the character's position and animations a number of seconds after that event has occurred:

Getting ready
For this recipe, we have prepared a Unity Package named Ragdoll, containing a basic scene that features an animated character, and a prefab already placed in the scene named Spawnpoint. The files can be found in the 09_08
folder.
How to do it...
To apply Ragdoll physics to your character, follow these steps:
- Create a new 3D project and import the Ragdoll Unity Package.
- Open the
mecanimPlayground
level. - You will see the animated MsLaser character and a disc, Spawnpoint.
- First, let's create and set up our Ragdoll. Create a new 3D Ragdoll by choosing Create |...