This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

RagDoll Body

RagDoll body enables inverse kinematics and procedural animation of a death sequence for bone-animated characters. This type of body is actually a set of Rigid bodies representing each bone of a character linked together by joints. These joints restrict movement of the bones relative to each other, providing realistic look.RagDoll物体使能反向运动学和死亡序列的程序动画骨骼动画人物。这种体型其实是一组刚体代表通过关节连接在一起的角色的每个骨骼。这些关节限制骨骼相对于彼此的运动,提供逼真的外观。

注意
RagDoll body can be assigned only to Mesh Skinned objects.RagDoll物体只能分配给 Mesh Skinned 对象。

RagDoll animation

RagDoll animationRagDoll动画

See also
也可以看看#

Assigning a RagDoll Body
分配RagDoll物体#

To assign a RagDoll body to an object via UnigineEditor perform the following steps:通过将 RagDoll物体分配给对象统一编辑器执行以下步骤:

  1. Open the World Hierarchy window.打开 World Hierarchy 窗口。
  2. Select a Mesh Skinned object to assign a RagDoll body to.选择一个网格蒙皮要为其分配 RagDoll物体的对象。
  3. Go to the Physics tab in the Parameters window and assign a physical body to the selected object by selecting Body -> RagDoll.转到 Parameters 窗口中的 Physics 选项卡并分配一个物理物体通过选择 Body -> RagDoll 到选定的对象。

    Adding a body

  4. Set the body name and refer to the next section to create a RagDoll.设置body名称,参考下一节创建RagDoll

Creating a Physical RagDoll
创建物理RagDoll#

There are two ways of creating a RagDoll:有两种方法可以创建 RagDoll

After the body is assigned to the Mesh Skinned, the first step is to create a Rigid body that will represent each bone in physical simulation.将 body 分配给 Mesh Skinned 后,第一步是创建一个 Rigid body,它将代表物理模拟中的每个骨骼。

For now, all the bones are free, meaning there is no Rigid body associated with them. To automatically generate a RagDoll, i.e. rigid bodies and approximating shapes along with joints to connect them, Create button should be clicked.目前,所有骨骼都是free ,这意味着没有 Rigid body 与它们关联。要自动生成 RagDoll,即刚体和近似形状以及连接它们的关节,应单击 Create 按钮。

注意
For proper automatic RagDoll generation the mesh should be in the Reference Pose (T-pose for human-like characters). If animation has been already applied to the mesh, apply an animation with the static Reference Pose.为了正确的自动 RagDoll 生成,网格应该处于参考姿势(T 姿势用于类人角色)。如果动画已应用到网格,请使用静态参考姿势应用动画。

Automatic generation is performed on the basis of the following parameters:自动生成基于以下参数执行:

Approximation Shape
近似形状#

Bones can be approximated either with Convex hull or Capsule, if Capsule shape box is checked:如果选中 Capsule shape 框,可以使用 Convex hullCapsule 来近似骨骼:

  • Capsule provides very fast physics simulation and continuous collision detection.Capsule 提供非常快速的物理模拟和连续碰撞检测。
  • Convex hull provides more accurate approximation.Convex hull 提供更准确的近似值。

If any other shape is required, approximation is to be done manually.如果需要任何其他形状,则应进行近似手动.

Approximation with capsules and convex hulls

Approximation with capsules and convex hulls胶囊和凸包的近似
注意
Remember that physical shapes need not reproduce the mesh precisely. Rough approximation provides physical interaction that is realistic and convincing enough.请记住,物理形状不需要精确地再现网格。粗略近似提供了足够真实和令人信服的物理交互。

Total Mass
Total Mass#

Total mass of the RagDoll will be automatically distributed among all the shapes that approximate bones. By distribution, the volume that the shape occupies is taken into account. If the mass is changed afterwards, all the shapes masses are recomputed. And the opposite way, if shape mass is changed, the total mass is modified correspondingly.全部的大量的RagDoll 将自动分布在所有近似骨骼的形状中。通过分布,形状占据的体积被考虑在内。如果此后更改了质量,则会重新计算所有形状的质量。反之,如果改变形状质量,则总质量也相应改变。

Approximation Error
Approximation Error#

If convex hulls are used to approximate bones, the result may contain too much detail for collision geometry. As a rule, it is unnecessary, because a highly detailed shape does not provide noticeable visual difference while significantly affecting performance. Approximation error makes it possible to control the number of vertices in the resulting convex hull:如果使用凸包来近似骨骼,则结果可能包含过多的碰撞几何细节。通常,这是不必要的,因为高度详细的形状不会提供明显的视觉差异,同时会显着影响性能。近似误差可以控制生成的凸包中的顶点数:

  • The lower the value, the more accurate and close to the mesh approximated shape is.该值越低,越准确和靠近啮合近似形状。
  • The maximum value of 1 provides quite rough approximation that may not cover all the mesh volume.1 的最大值提供了可能无法覆盖所有网格体积的非常粗略的近似值。

If a character is approximated with capsules, low value of approximation error provides more precise shape orientation.如果使用胶囊来近似字符,则近似误差的低值提供更精确的形状方向。

Volume Threshold
Volume Threshold#

When creating a RagDoll, small bones (like finger bones, for example) are rarely simulated. They are too insignificant to change the motion of the whole object, as their mass and volume is not sufficient for that. Volume threshold allows to merge all small adjacent bones, the volume of which is too small, into one shape:创建 RagDoll 时,很少模拟小骨骼(例如手指骨骼)。它们太微不足道了,无法改变整个物体的运动,因为它们的质量和体积不足以改变整个物体的运动。体积阈值允许将所有体积太小的相邻小骨骼合并为一个形状:

  • By the minimum value of 0, all the bones without exception are represented in rigid bodies and hence shapes.通过 0 的最小值,所有骨骼无一例外都以刚体和形状表示。
  • By the maximum value of 1, approximation shapes are big and follow only the major bones. Small bones are included in this volume, but their individual transformations are not considered in physical simulation.通过 1 的最大值,近似形状很大并且仅跟随主要骨骼。此卷中包含小骨骼,但在物理模拟中不考虑它们的个别变换。
Minimum volume threshold     Maximum volume threshold
Volume threshold defines whether all bones up to the smallest one should be simulated separately or merged into bigger shapes体积阈值定义了是否应该单独模拟所有骨骼直到最小的骨骼或合并为更大的形状

 

Body Hierarchy for Bones
骨骼的物体层次结构#

After a RagDoll has been created, all the bones that are represented in rigid bodies and shapes and specify their movement are marked as bound in the hierarchy. All the small bones not participating in physical body movement, stay marked as free. If automatically generated shapes are too loose, they can be tuned manually till approximation is satisfying enough.创建 RagDoll 后,所有以刚体和形状表示并指定其运动的骨骼在层次结构中都标记为绑定。所有不参与物体运动的小骨头,都标记为空闲。如果自动生成的形状太松散,可以手动调整它们直到近似值足够令人满意。

Hierarchy of bodies and shapes that approximate bones can be saved into a *.node file and loaded from it. The set hierarchy can as well be removed from the RagDoll body and created anew.近似骨骼的物体和形状的层次结构可以保存*.node保存到文件中并从中加载。集合层次结构也可以从 RagDoll物体中删除并重新创建。

代表骨骼的刚体层次

Manual Creation of a RagDoll
手动创建RagDoll#

It is also possible to create a RagDoll manually. In this case arbitrary shapes can be used to approximate bones of a RagDoll body. To create a RagDoll manually follow these steps:也可以手动创建 RagDoll。在这种情况下,可以使用任意形状来近似 RagDoll物体的骨骼。要手动创建 RagDoll,请执行以下步骤:

  1. Create a Node Dummy that will be a parent node for future RagDoll hierarchy.创建一个 Node Dummy,它将成为未来 RagDoll 层次结构的父节点。
  2. Add a Dummy Object and make it a child node. Assign a Rigid body to it and name the body after the bone it will represent. After that, approximate the bone with any necessary shape.添加一个 Dummy Object 并使其成为子节点。为它分配一个 Rigid body 并以它所代表的骨骼命名物体。之后,用任何必要的形状近似骨骼。
  3. Create all Rigid bodies and shapes for the RagDoll bones. Hierarchy is of no importance, only names of the bodies do — they should be the same as the names of the bones. If body names mismatch bone names, it will cause an error.RagDoll 骨骼创建所有 Rigid 实体和形状。等级并不重要,重要的是物体的名字——它们应该和骨骼的名字一样。如果体名与骨名不匹配,将导致错误。
  4. Export the parent node into the *.node file.将父节点导出到 *.node 文件中。
  5. Select the character and load this file for its RagDoll body.选择角色并为其 RagDoll物体加载此文件。
  6. Add and set up joints that connect rigid bodies within the RagDoll.添加和设置连接 RagDoll 内刚体的关节。

Enabling RagDoll Animation
启用RagDoll动画#

When the character hits some obstacle or, for example, he is shot and dies, it is necessary to turn off bone-based animation playback and simulate the character realistically falling according to the physical laws. When the Frame-based box is unchecked, RagDoll body is no longer driven by the bone transformations. It collapses according to Rigid body dynamics (masses of all rigid bodies, that represent parts of a RagDoll, velocity damping, etc.), joint constraints and Rigidity of motion.当角色撞到障碍物或中弹身亡时,需要关闭骨骼动画播放,根据物理规律真实模拟角色坠落。取消选中 Frame-based 框时,RagDoll物体不再由骨骼变换驱动。它根据Rigid body 动力学质量所有刚体,代表 RagDoll 的一部分,速度阻尼等),联合约束和刚性的运动。

注意
Enabling RagDoll animation influences only those bones that were physically approximated. For example, small bones that were discarded due to volume threshold, will still move. To prevent this from happening, mesh animation should be stopped explicitly.启用 RagDoll 动画只会影响物理上近似的骨骼。例如,由于以下原因被丢弃的小骨头音量阈值,还是会动。为了防止这种情况发生,网格动画应该停止明确地。

Rigidity of Movement
运动刚性#

The Rigidity parameter allows to additionally constrain the motion of a RagDoll. It determines how uniform the motion of RagDoll parts is. To achieve that, both linear and angular velocities of each separate rigid body are corrected according to the total velocities interpolated from all the bodies.Rigidity 参数允许额外限制 RagDoll 的运动。它决定了 RagDoll 部分的运动有多均匀。为了实现这一点,每个单独刚体的线速度和角速度都根据从所有刚体插入的总速度进行校正。

  • By the minimum value of 0, all RagDoll parts represented in rigid bodies move independently and unrestricted (of course, except for joint constrains). This gives an impression of loose and floppy movement.通过 0 的最小值,刚体中表示的所有 RagDoll 部分独立且不受限制地移动(当然,关节约束除外)。这给人一种松散和松软运动的印象。
  • By the maximum value of 1, RagDoll parts move in a uniform and stiff manner, which may seem over-constrained.通过 1 的最大值,RagDoll 零件以均匀和僵硬的方式移动,这似乎过度约束。

Combined Animation and Inverse Kinematics
组合动画和反向运动学#

The problem with pre-baked animation is that it does not offer proper environmental interaction. For example, when walking up or down the hill, character's feet do not land firmly on terrain. Or as it climbs the ladder, the hands have to tightly grab the rungs. This effect is achieved with combined animation: motion animation is played for the basic bones, while smaller bones (feet or hands, for example) are simulated physically.预先准备的动画的问题在于它不提供适当的环境交互。例如,在上山或下山时,角色的脚不会稳固地着地。或者当它爬上梯子时,手必须紧紧抓住梯级。这种效果是通过组合动画实现的:为基本骨骼播放运动动画,而对较小的骨骼(例如脚或手)进行物理模拟。

Frame-based animation can be disabled for each of the rigid bodies that approximate bones. Instead of following specific bone transformation, rigid body sags loose under its own weight and connects to collider objects underneath it.可以为每个近似骨骼的刚体禁用基于帧的动画。刚体不遵循特定的骨骼变换,而是在其自身重量下下垂并连接到其下方的碰撞对象。

For instance, physically-driven motion of the leg requires disabling bone animation of the whole limb: thigh, calf, and foot. Inverse kinematics allows to properly position the chain of bones given the position of the lowest bone in the hierarchy, the foot. So when the character walks or runs, his foot collides with the ground, while the knee bends and straightens according to the joint constrain.例如,腿部的物理驱动运动需要禁用整个肢体的骨骼动画:大腿、小腿和脚。给定层次结构中最低骨骼(脚)的位置,反向运动学允许正确定位骨骼链。因此,当角色走路或跑步时,他的脚会与地面发生碰撞,而膝盖则根据关节约束弯曲和伸直。

Inverse Kinematics

With inverse kinematics feet of the characters are tightly glued to the floor no matter how tilted the surface is借助反向运动学,无论表面如何倾斜,人物的脚都紧紧地粘在地板上
最新更新: 2024-12-13
Build: ()