This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Программирование на C#
Рендеринг
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Setting Up Properties
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
UnigineScript
C++
C#
Унифицированный язык шейдеров UUSL
File Formats
Rebuilding the Engine Tools
GUI
Двойная точность координат
API
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
Работа с контентом
Оптимизация контента
Материалы
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

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.

Notice
Ragdoll bodies can be assigned only to skinned mesh objects.

Ragdoll animation

Ragdoll animation

See also#

Assigning a Ragdoll Body#

To assign a ragdoll body to an object via UnigineEditor perform the following steps:

  1. Open the World Hierarchy window
  2. Select a skinned mesh object to assign a ragdoll body to.
  3. Go to the Physics tab in the Parameters window and assign a physical body to the selected object by selecting Body -> Ragdoll.

    Adding a body

  4. Set body's name and refer to the next section to create a ragdoll.

Creating a Physical Ragdoll#

There are two ways of creating a ragdoll:

After the body is assigned to the skinned mesh, the first step is to create a rigid body that will represent each bone in physical simulation.

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.

Notice
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.

Automatic generation is performed on the basis of the following parameters:

Approximation Shape#

Bones can be approximated either with Convex hulls or Capsules, if Capsule shape box is checked:

  • Capsules provide very fast physics simulation and continuous collision detection.
  • Convex hulls provide more accurate approximation.

If any other shape is required, approximation is to be done manually.

Approximation with capsules and convex hulls

Approximation with capsules and convex hulls
Notice
Remember, physical shapes need not reproduce the mesh precisely. Rough approximation provides physical interaction that is realistic and convincing enough.

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.

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.

If a character is approximated with capsules, low value of approximation error provides more precise shape orientation.

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:

  • By the minimum value of 0, all the bones without exception are represented in rigid bodies and hence shapes.
  • 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.

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.

Hierarchy of bodies and shapes that approximate bones can be saved into a .node and loaded from one. The set hierarchy can as well be removed from the ragdoll body and created anew.

Hierarchy of rigid bodies that represent bones

Manual Creation of a 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:

  1. Create a dummy node that will be a parent node for future ragdoll hierarchy.
  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.
  3. Create all rigid bodies and shapes for the ragdoll bones. Hierarchy is of no importance, only names of the bodies do.
  4. Export the parent node into the .node file.
  5. Select the character and load this file for its ragdoll body.
  6. Add and set up joints that connect rigid bodies within the ragdoll.

Enabling Ragdoll Animation#

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 animation 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.

Notice
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.

Rigidity of Movement#

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.

  • 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.
  • By the maximum value of 1, ragdoll parts move in a uniform and stiff manner, which may seem over-constrained.

Combined Animation and Inverse Kinematics#

The problem with pre-backed 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 he 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
Last update: 09.04.2021
Build: ()