This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API Reference
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
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

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 one in terms of performance.

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

Rigid bodies

See also#

Assigning a Rigid Body#

To assign the 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 the body name and change other parameters, if necessary.

Parameters#

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

Immovable

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 being a collider object.

Gravity Toggles the gravity for the body on and off.
Freezable

Enables freezing physical simulation of the body when necessary.

Notice
This 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.
Shape-Based

Toggles automatic calculation of certain parameters of a rigid body (total mass, center of mass, and inertia tensor) on the basis of parameters determined for its shapes on and off.

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 the Shape-based option is enabled.

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 the body parameters, they are still used to determine the distribution of mass within the object.

Disabling the Shape-based option makes it possible to manually redefine such total parameters for the body as Center of mass and moment of Inertia.

High Priority Contacts

On collision, contacts are distributed randomly between the interacting bodies to optimize performance: some are handled by the first body, others by the second. For a body, contacts that it handles itself are internal (access to them is fast), and contacts handled by other bodies are external. This option makes the body handle most of its contacts itself (so that most of them are internal). Thus, you can track collisions of a certain body with maximum efficiency.

Notice
You can iterate through all contacts for a body, but for better performance it is recommended to process only internal ones.
Name

Name of the body.
Physical Bit mask for interactions with physicals. Used to enable selective interaction: two objects interact, if they both have matching masks (one bit at least).
Mass

Mass of the body, in kilograms.

Notice
Do not use real masses, this can make physics simulation unstable. Adjust mass values when necessary to achieve realistic behavior (e.g. for a wheel mass of 25 kg it might be better to set 60 kg for a car body instead of 2000 kg). It is very important to ensure mass balance – avoid connection of too heavy bodies to very light ones, otherwise the joints may become unstable!
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
CMass

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.
LScale Multipliers for the body's linear velocity along the axes. Setting any value to 0, restricts movement along the corresponding axis.
AScale Multiplier for the body's angular velocity along the X axis. When set to 0, rotation along this axis will be restricted.
LDamping

Linear damping reduces linear velocity of the body over time and slows it down up to a complete stop. Higher values make the body slow down faster. Global linear damping is added to the linear damping of the body to calculate resulting value.

ADamping

Angular damping reduces angular velocity of the body over time and slows it down until its rotation ceases. Higher values make the body slow down faster. Global angular damping is added to the angular damping of the body to calculate resulting value.

MLVelocity

Maximum linear velocity defines the maximum possible velocity of the body. Values exceeding this limit will be clipped. There is also a global maximum linear velocity threshold, it is compared with the maximum set for the body, and the minimum is chosen for actual velocity clipping.

MAVelocity

Maximum angular velocity defines the maximum possible angular velocity of the body. Values exceeding this limit will be clipped. There is also a global maximum angular velocity threshold, it is compared with the maximum set for the body, and the minimum is chosen for actual velocity clipping.

FLVelocity Frozen linear velocity defines the value of linear velocity at which the body becomes frozen. Such body is excluded from physical simulation until it remains idle, which significantly reduces simulation load and improves performance. There is also a global frozen linear velocity, it is compared with the value set for the body, and the maximum is chosen for body freezing.
FAVelocity Frozen angular velocity defines the value of angular velocity at which the body becomes frozen. Such body is excluded from physical simulation until it remains idle, which significantly reduces simulation load and improves performance. There is also a global frozen angular velocity, it is compared with the value set for the body, and the maximum is chosen for body freezing.

The information on this page is valid for UNIGINE 2.20 SDK.

Last update: 2025-03-21
Build: ()