Unity has a simple wizard that lets you create your own ragdoll in no time. You simply have to drag the different limbs on the respective properties in the wizard. Then select create and Unity will automatically generate all Colliders, Rigidbodies and Joints that make up the Ragdoll for you.
Unity拥有一个简单的向导可以让你即时的创建一个属于自己的布娃娃,你只需简单的在向导中分别拖动四肢的各种属性,然后选择创建,Unity会自动的生成所有的碰撞、刚体和关节,它将为你完成这个布娃娃。
Creating the Character 创建一个角色
Ragdolls make use of Skinned Meshes, that is a character mesh rigged up with bones in the 3D modeling application. For this reason, you must build ragdoll characters in a 3D package like Maya or Cinema4D.
布娃娃要利用蒙皮网格制作,它是你在3D建模工具中创建一个带骨骼的角色模型,因此,你必须在一个3D程序中创建布娃娃角色,如Maya或者Cinema4D。
When you've created you character and rigged it, save the asset normally in your Project Folder. When you switch to Unity, you'll see the character asset file. Select that file and choose Assets->Import Settings... from the menu bar. In the Import Settings dialog, make sure that Generate Meshes is not enabled.
当你创建好你的角色并设置好它,将这个资源正常的保存的你的工程文件夹,当你切换到Unity,你将会看到这个角色资源文件,选中这个文件然后在菜单栏选择Assets->Import Settings...,在导入设置对话框中,确保Generate Meshes为不可用状态
Using the Wizard 使用向导
It's not possible to make the actual source asset into a ragdoll. This would require modifying the source asset file, and is therefore impossible. You will make an instance of the character asset into a ragdoll, which can then be saved as a Prefab for re-use.
将当前的源文件用到布娃娃中是不可能的,它会修改源文件,所以这是不可能的。你需要创建一个角色资源的实例赋予给布娃娃,这个实例需要可以被保存为可重用的Prefab。
Create an instance of the character by dragging it from the Project View to the Hierarchy View. Expand its Transform Hierarchy by clicking the small arrow to the left of the instance's name in the Hierarchy. Now you are ready to start assigning your ragdoll parts.
从工程视图拖动角色到层级视图即可创建一个角色的实例,点击层级中实例名字左边的小箭头展开它的变换层级,现在你就可以准备开始设定你的布娃娃的各个部分了。
Open the Ragdoll Wizard by choosing GameObject->Create Other->Ragdoll from the menu bar. You will now see the Wizard itself.
选择菜单栏中的GameObject->Create Other->Ragdoll打开布娃娃向导。你将会看到向导视窗。
The Ragdoll Wizard 布娃娃向导
Assigning parts to the wizard should be self-explanatory. Drag the different Transforms of your character instance to the appropriate property on the wizard. This should be especially easy if you created the character asset yourself.
通过向导可以一目了然的设定各个部分,将角色实例中不同的变换组件拖动到向导中相应的属性框中,这将使你轻而易举的创建出自己的角色资源。
When you are done, click the Create Button. Now when you enter Play Mode, you will see your character go limp as a ragdoll.
当你完成以后,点击创建按钮,然后进入播放模式,你就会看到你的角色想一个布娃娃一样动了。
The final step is to save the setup ragdoll as a Prefab. Choose Assets->Create->Prefab from the menu bar. You will see a New Prefab appear in the Project View. Rename it to "Ragdoll Prefab". Drag the ragdoll character instance from the Hierarchy on top of the "Ragdoll Prefab". You now have a completely set-up, re-usable ragdoll character to use as much as you like in your game.
最后一步是将这个设置好的布娃娃保存为一个Prefab,选择菜单栏中的Assets->Create->Prefab ,你会看到一个新的Prefab出现在你的工程视图中,将它重命名为"Ragdoll Prefab".从层级中拖动布娃娃角色实例到这个"Ragdoll Prefab"上面,你就制作完成了,你就可以在你的游戏任意中使用这个布娃娃角色了。