Unity 有一个简单的向导可用于快速创建布娃娃。只需在向导中的各种属性上拖动不同的肢体即可。然后,选择 Create,Unity 便会自动生成构成布娃娃的所有__碰撞体、刚体__和__关节__。
布娃娃使用__蒙皮网格__;这是在 3D 建模应用程序中使用骨骼装配的角色网格。因此,必须在 Autodesk® Maya® 等 3D 软件包中构建布娃娃角色。
创建角色并进行装配后,将资源正常保存在 Project 文件夹__中。切换到 Unity 时,您将看到该角色资源文件。选择该文件,然后 Inspector 中将显示 Import Settings__ 对话框。确保未启用 Mesh Colliders。
不太可能将实际的源资源变成一个布娃娃。这将需要修改源资源文件,因此是不可能的。正确的做法是将角色资源的实例变成一个布娃娃,然后保存为__预制件__以供重复使用。
创建角色实例的方法是将角色从 Project 视图__拖动到 Hierarchy 视图。单击层级视图中实例名称左侧的小箭头,展开其__变换层级视图。现在已准备好开始分配布娃娃部件。
从菜单栏中选择 GameObject > 3D Object > Ragdoll… 以打开布娃娃向导。现在将看到向导本身。
为布娃娃分配部件的过程不言自明。将角色实例的不同变换拖动到向导上的相应属性。如果已自行创建角色资源,此过程应该特别容易。
完成后,单击 Create 按钮。现在进入__播放模式__时,应该会看到角色像布娃娃一样跛行。
最后一步是将设置的布娃娃保存为预制件。从菜单栏中选择__Assets > Create > Prefab__。随后将看到在 Project 视图中显示了一个新预制件 (New Prefab)。将该预制件重命名为“Ragdoll Prefab”。将布娃娃角色实例从层级视图拖动到“Ragdoll Prefab”上。现在有了一个完整设置并可重复使用的布娃娃角色,可在游戏中任意多次使用。
For Character Joints made with the Ragdoll wizard, the joint’s Twist axis corresponds with the limb’s largest swing axis, the joint’s Swing 1 axis corresponds with the limb’s smaller swing axis, and the joint’s Swing 2 axis is for twisting the limb. This naming scheme is for legacy reasons.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.