This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Rigid Body

Along with static meshes, objects with rigid bodies are most commonly used. Assigning an objects rigid body together with collision shape ensures that it moves and realistically interacts with other objects according to rigid bodies dynamics. Representing objects as rigid bodies is the most effective in terms of performance.

It is characterized by total mass of all its shapes, damping of linear and angular velocities etc. In addition to that, it is possible to control the undermentioned parameters.

Rigid bodies

See also

Shape-based mass parameters

The rigid body is comprised of shapes that approximate its volume. A shape has a mass (and density), a center of mass and inertia tensor calculated on the base of the previous two. As for the whole body, these parameters of each shape and shape positioning within the body can be used to compute the body's total mass and inertia properties. This computation is automatically done if Shape-based mass parameters box is checked.

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

Unchecking the Shape-based mass parameters box allows to redefine some total parameters for the body: corresponding fields are activated where the custom values are set up manually. For example, body's mass overrides the calculated sum of all the shapes masses.

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 for more desirable and pleasing to the eye. For example, tilting doll with a sphere shape requires an uneven mass distribution: its weight should be centered closer to the bottom, so it always stands up when tilted.

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

Inertia

The moment of inertia describes the resistance to rotation of the body in different directions. It is a rotational analog of mass for linear motion. However, it's not only related to the total mass of the body, but also to the distribution of the mass throughout the body. The farther from the axis of rotation is, the more rotational inertia the body has. For example, imagine rotating a dumbbell around the center: if the weights are far on the opposite sides, the speed of rotation decreases. And vice versa, bringing the weights closer to the center results in faster and more effortless spinning.

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

Ixx     Ixy     Ixz    
Iyx     Iyy     Iyz    
Izx     Izy     Izz    

Here Ixx sets the moment of inertia around theX-axis when the body is rotated around the X-axis, Ixy sets the moment of inertia around theY-axis when the objects are rotated around the X-axis, etc. As for values:

  • The higher the moment of inertia value, the more torque should be be applied to rotate the body about a particular axis. Conversely, the lower the value, the easier it is to change the angular velocity of a body about a particular axis. Values are corrected with respect to the average value to provide smoother movement.
  • 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 zero. Otherwise, the body may start to rotate chaotically.
Notice
Values should be no lower than 0.011. Otherwise, the matrix won't be properly inverted, which is necessary to apply collision impulse.

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 a 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.
Last update: 2017-07-03
Build: ()