This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Настройка свойств
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World 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.

Rigid Body

Rigid body enables simulation of physical bodies in accordance with rigid body dynamics. This type of body is the most commonly used and the most efficient in terms of performance.

Notice
A rigid body must have at least one collision shape assigned.

Rigid bodies

The set of parameters of a rigid body in accordance with rigid body dynamics includes the following:

See also#

Programming realization:

Shape-based mass parameters#

Volume of a rigid body can be approximated by several shapes (e.g. a concave object divided into a set of convex hulls or a ragdoll body). Each shape has its mass and density. Therefore certain parameters of a rigid body, such as its total mass, center of mass, and inertia tensor, are determined by its shapes. These parameters can be calculated automatically if Shape-based mass parameters option is enabled.

To enable this option for a body via UnigineEditor perform the following steps:

  1. Select the desired object with a rigid body assigned.
  2. Go to the Physics tab in the Parameters window.
  3. In the Body section check Shape-based option.
Notice
Setting the individual masses or densities of the shapes is the most intuitive method to achieve correct physical behavior of the body. Even if overridden by body parameters, they are still used to determine the distribution of mass within the object.

Shapes that approximate rigid bodies

Rigid bodies that are approximated with different shapes according to their geometry

Overriding Shapes Parameters#

Disabling the Shape-based mass parameters option makes it possible to manually redefine some total parameters for the body.

To disable this option for a body via UnigineEditor perform the following steps:

  1. Select the desired object with a rigid body assigned.
  2. Go to the Physics tab in the Parameters window.
  3. In the Body section check Shape-based option. The fields of total parameters for the body will be activated.
  4. Set up body parameters manually.

Center of mass#

An arbitrary point can be set to be a center of mass of the body. It may be necessary to correct the motion of an object to provide desirable look. For example, a tilting doll with a sphere shape requires an uneven mass distribution: its center of mass should be located closer to the bottom, so it always stands up when tilted.

Notice
Center of mass is set as coordinates of the point in local space of the body.

Moment of Inertia#

The moment of inertia is a rotational analog of mass, describing the resistance of the body to rotation in different directions. It is determined by the distribution of mass throughout the body volume. The farther from the axis of rotation the center of mass is, the more rotational inertia the body has.

The inertia tensor that allows to compute a moment of inertia about an arbitrary axis is represented as a matrix, I:

Ixx     Ixy     Ixz    
Iyx     Iyy     Iyz    
Izx     Izy     Izz    

where Iij sets the moment of inertia around the i -axis when the body is rotated around the j-axis.

Notice
To rotate the body evenly about the rotation axis, the matrix should be diagonal, i.e all values outside the main diagonal are set to 0. Otherwise, the body may start to rotate chaotically.

As for values of the moment of inertia:

  • The higher the value, the more torque must be be applied to rotate the body about a particular axis.
  • The lower the value, the easier it is to change the angular velocity of a body about a particular axis.
    Notice
    It is not recommended to set values less than 0.011! Otherwise, the matrix won't be properly inverted, which is necessary to apply collision impulse.
Values are corrected with respect to the average value to provide smoother movement.

For example, the following illustration shows three boxes with different inertia tensors. The yellow box has very high inertia:

100         0         0    
    0     100         0    
    0         0     100    

Because of that, it can only slide down when falling upon the tilted plane. The red box, on the contrary, has the lowest inertia and rotates most eagerly.

Different Inertia tensors

Different inertia tensors that override shape-based parameters

Freezable Body#

If the Freezable flag is set for a rigid body, its simulation is freezed when necessary.

Notice
Freezable flag is recommended to be always set for all rigid bodies except for Player Actor. Freezing a player causes it to react to the user's input with a time lag, small but nonetheless perceptible.

Immovable#

The Immovable flag toggles the static mode for a rigid body on and off. If the flag is set, the body will ignore all forces in the world and keep its position while remaining to be a collider object.

Assigning a Rigid Body#

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

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

    Adding a body

  4. Set body's name and change other parameters if necessary.
Last update: 29.04.2021
Build: ()