Game Development Reference
In-Depth Information
FigureĀ 10.14
Manually adding
the foot bones to
the ragdoll
When you play the scene now, the entire zombie should crumple as a ragdoll object
would. Since you will want to use this ragdoll again in other scenes, it would be a good
idea to create a prefab out of it:
1. If you do not already have one, create a folder in the Project view called Prefabs . Use
the Create menu again to create a Prefab object in this folder.
2. Create a new JavaScript file in your Scripts folder called CorpseTidy.js . Put the fol-
lowing code in this new file:
function Start () {
Destroy(gameObject,5);
}
This code destroys the object five seconds after it appears, giving the ragdoll just
enough time to fall and be on the ground for a few seconds. If you do not add this to
your ragdoll, rigged polygonal bodies will pile up and crash the computer.
3. Add this script to your zombie ragdoll object.
4. Your new prefab should be a white box, which means that it is an empty prefab. Call
the new prefab ProfZombieRagdoll .
Search WWH ::




Custom Search