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

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.Rigid物体可以根据Rigid物体动态.这种类型的车身是最常用的,在性能方面也是最有效的。

注意
A Rigid body must have at least one collision shape assigned.Rigid物体必须至少有一次碰撞形状分配。

Rigid bodies

The set of parameters of a Rigid body in accordance with Rigid body dynamics includes the following:一个Rigid物体的参数集按照Rigid物体动态包括以下内容:

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 the Shape-based option is enabled.Rigid物体的体积可以近似为几个形状(例如,一个凹对象被分成一组凸包或一个 Ragdoll物体)。每个形状都有它的大量的密度.因此,Rigid物体的某些参数,例如其总质量、质心和惯性张量,由其形状决定。如果启用了 Shape-based 选项,则可以自动计算这些参数。

To enable this option for a body via UnigineEditor perform the following steps:通过以下方式为物体启用此选项统一编辑器执行以下步骤:

  1. Select the desired object with a Rigid body assigned.选择指定为 Rigid物体的所需对象。
  2. Go to the Physics tab in the Parameters window.转到 Parameters 窗口中的 Physics 选项卡。
  3. In the Body section, check the Shape-based option.Body 部分,选中 Shape-based 选项。
注意
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.设置形状的各个质量或密度是实现物体正确物理行为的最直观方法。即使被覆盖通过物体参数,它们仍然用于确定物体内的质量分布。

Shapes that approximate rigid bodies

Rigid bodies that are approximated with different shapes according to their geometry根据几何形状近似为不同形状的刚体

Overriding Shapes Parameters
覆盖形状参数#

Disabling the Shape-based option makes it possible to manually redefine some total parameters for the body. 禁用Shape-based选项可以手动重新定义物体的一些总参数。

To disable this option for a body via UnigineEditor perform the following steps:通过以下方式为物体禁用此选项统一编辑器执行以下步骤:

  1. Select the desired object with the Rigid body assigned.选择指定为 Rigid物体的所需对象。
  2. Go to the Physics tab in the Parameters window.转到 Parameters 窗口中的 Physics 选项卡。
  3. In the Body section, check Shape-based option. The fields of total parameters for the body will be activated.Body 部分,选中 Shape-based 选项。物体的总参数字段将被激活。
  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.可以将任意点设置为质心的物体。可能需要校正对象的运动以提供理想的外观。例如,一个球形的不倒翁需要不均匀的质量分布:它的质心应该位于更靠近底部的位置,所以它在倾斜时总是站起来。

注意
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:允许计算关于任意轴的惯性矩的惯性张量表示为矩阵 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.其中 Iij 设置当物体围绕 j 轴旋转时围绕 i 轴的转动惯量。

注意
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.要绕旋转轴均匀地旋转物体,矩阵应该是对角的,即主对角线之外的所有值都设置为 0。否则,物体可能会开始混乱地旋转。

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.值越低,越容易改变物体绕特定轴的角速度。

    注意
    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.不建议设置小于 0.011 的值!否则,矩阵将无法正确反转,这是应用碰撞脉冲所必需的。

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 that override shape-based parameters覆盖基于形状的参数的不同惯性张量

Freezable Body
冻结物体#

If the Freezable flag is set for a Rigid body, its simulation is freezed when necessary.如果为 Rigid物体设置了 Freezable 标志,则其模拟被冻结必要时。

注意
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.建议始终为除 Player Actor 之外的所有刚体设置 Freezable 标志。冻结玩家会导致它对用户的输入做出反应,时滞很小,但仍然可以察觉。

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 being a collider object.Immovable 标志打开和关闭 Rigid物体的静态模式。如果设置了标志,则物体将忽略世界上的所有力并保持其位置,同时仍然是对撞机对象。

Assigning a Rigid Body
指定刚体#

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

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

    Adding a body

  4. Set the body name and change other parameters if necessary.如有必要,设置物体名称并更改其他参数。
最新更新: 2024-12-13
Build: ()