# Fracture Body

Fracture body enables real-time persuasive destruction of objects. When collision with some body occurs, a destructible object is procedurally fractured into pieces, which in turn can also be fractured until the desired level of destruction is achieved. Fracture bodies are quite inexpensive type, and can be broken into a moderately large number of pieces.Fracture物体可实现对对象的实时有说服力的销毁。当与某个物体发生碰撞时，一个可破坏的物体会被程序化破碎的碎片，反过来也可以破碎，直到达到所需的破坏水平。Fracture物体是相当便宜的类型，可以破碎成中等数量的碎片。

Fracture bodies broken into piecesFracture物体破碎成碎片

Fracture body can be assigned only to Mesh Dynamic objects and can be used for convex meshes only.Fracture物体只能分配给 Mesh Dynamic 对象，并且只能用于凸面网格。

## Physical Approximation物理近似#

Fracture body (as well as all the pieces it fractures into) is, in fact, a Rigid body that moves according to rigid body dynamics. Therefore, it has the following properties:Fracture物体（以及它分裂成的所有碎片）实际上是一个 Rigid物体，它根据刚体动力学.因此，它具有以下特性：

After the body was fractured, its mass is distributed among the pieces and they tumble down as rigid bodies would do.物体断裂后，它的质量分布在碎片中，它们像刚体一样下落。

### Shape Approximation Error形状近似误差#

Fracture body is always approximated with a convex hull, which 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 collision shape:Fracture物体总是近似为凸包，其中可能包含过多的碰撞几何细节。通常，这是不必要的，因为高度详细的形状不会提供明显的视觉差异，同时会显着影响性能。Approximation Error（近似误差）可以控制最终碰撞形状中的顶点数量：

• By the value of 0, the shape precisely duplicates the mesh; the whole volume of it is enclosed.通过0的值，形状精确地复制了网格；它的整个体积都是封闭的。
• The higher the value, the fewer vertices there are in the created shape, but the more details are skipped and the shape may not cover the whole mesh volume. The maximum value is 1.值越高，创建的形状中的顶点越少，但跳过的细节越多，形状可能无法覆盖整个网格体积。最大值为 1

An autogenerated shape of a Fracture body is not displayed in the Shapes list on the Physics tab of the Parameters window. You can not remove it or assign any other shape to a Fracture body.Fracture物体的自动生成形状不会显示在 Parameters 窗口的 Physics 选项卡上的 Shapes 列表中。您不能删除它或将任何其他形状分配给 Fracture物体。

## Fracturing压裂#

There are three patterns of fracturing:压裂分为三种模式：

These patterns determine fracture paths that are relevant to different mechanical properties of materials (e.g., its toughness and porosity). Fracture patterns are available for choosing on the script level.这些模式决定了与材质的不同机械性能（例如，其韧性和孔隙率）相关的断裂路径。断裂模式可用于在脚本级别进行选择。

### Slicing切片#

Slicing is a fracture pattern separating the mesh volume into two pieces by a plane. The plane passes through a specified point of the body. Slicing angle is determined by a specified normal.切片是一种断裂模式，通过平面将网格体积分成两部分。平面通过物体的指定点。切片角度由指定的法线确定。

Fracturing body into two slice pieces将体压裂成两片

To slice a Fracture body use the createSlicePieces() method.要切片 Fracture物体，请使用 createSlicePieces() 方法。

### Cracking开裂#

Cracking is a fracture pattern involving formation of radial cracks from the point of collision. All of the crack pieces slightly vary in size to ensure visual realism. Moreover, the mesh can be additionally fractured along concentric rings, simulating spread of the impulse. The thiner and more brittle the material is (e.g., glass), the more rings tend to be formed by fracturing. The specified distance between the rings is also randomly varied to provide convincing result.裂纹是一种断裂模式，涉及从碰撞点形成径向裂纹。所有裂纹块的大小略有不同，以确保视觉真实感。此外，网格还可以沿同心环断裂，模拟脉冲的传播。材质（例如玻璃）越薄和越脆，通过破裂形成的环就越多。环之间的指定距离也随机变化以提供令人信服的结果。

Creating crack pieces with different number of radial cracks and concentric rings创建具有不同数量的径向裂纹和同心环的裂纹片

To crack a Fracture body use the createCrackPieces() method.要破解 Fracture物体，请使用 createCrackPieces() 方法。

### Shattering粉碎#

Shattering is a fracture pattern randomly dividing the mesh volume into the specified number of convex chunks.破碎是一种断裂模式，将网格体积随机分成指定数量的凸块。

Creating different number of shatter pieces创建不同数量的碎片

To shatter a Fracture body use the createShatterPieces() method.要粉碎 Fracture物体，请使用 createShatterPieces() 方法。

### Volume ThresholdVolume Threshold#

As the body is fractured, especially for several times, small pieces may start to hit the performance. Volume threshold determines the minimum volume for fractured pieces and thus controls the level of fracturing. All chunks that are smaller than the specified value, will not be generated.随着物体骨折，尤其是几次骨折，小碎片可能会开始影响性能。体积阈值决定了破碎件的最小体积，从而控制了破碎水平。将不会生成小于指定值的所有块。

• By the minimum value of 0, all the pieces up to the smallest one created by fracturing are simulated.通过 0 的最小值，模拟所有碎片，直到由压裂产生的最小碎片。
• By higher values, only pieces big enough are generated. If no pieces have sufficient volume, the body stays unbroken.通过更高的值，只生成足够大的块。如果没有碎片有足够的体积，则物体保持完整。

## Broken Body破碎的物体#

After the body has been fractured, it acquires a Broken flag. Unsetting this flag puts the fractured mesh back into unbroken state. The broken body remains represented as one node in the UnigineEditor hierarchy. Generated fractured pieces are automatically represented as Fracture bodies and they inherit physical parameters of the fractured body (such as damping of linear and angular velocities, friction, restitution and masks).物体骨折后，它会获得一个 Broken 标志。取消设置此标志会使断裂的网格恢复到完整状态。破碎的物体仍然表示为一个节点UnigineEditor 层次结构.生成的碎块自动表示为 Fracture 体，它们继承了碎体的物理参数（如减震线速度和角速度，摩擦,归还和面具）。

Fractured pieces cannot be manipulated using the UnigineEditor!无法使用 UnigineEditor 操作破碎的碎片！

### Fracture Surface Material骨折面材质#

When fracturing a mesh, it is necessary to set the material that will be applied to all newly created fracture surfaces. Those faces of fracture pieces that were external, keep the initial material.破碎网格时，必须设置将应用于所有新创建的断裂表面的材质。外部骨折块的那些面保留了初始材质。

### Fracture Surface Property断裂面特性#

A new property for all fracture surfaces can also be assigned. They define game behavior and additional physical properties, however, body parameters override them.还可以为所有断裂面指定一个新属性。它们定义了游戏行为和其他物理属性，但是，物体参数会覆盖它们。

## Physics Intersections物理交叉点#

Physics intersections can be used as a quick way to check if a destructible object was hit by a projectile. You can use the Physics Intersection Mask to enable selective intersection detection for a body (e.g., to make it hittable by certain projectiles). Physics intersections are detected only for matching bit masks.物理交叉点可用作检查可破坏物体是否被射弹击中的快速方法。您可以使用 Physics Intersection Mask 为物体启用选择性交叉检测（例如，使其可被某些射弹击中）。仅在匹配时检测物理交叉点位掩码.

## Performance Optimization Tips性能优化技巧#

Although the Fracture body is a relatively inexpensive type, in case of large number of fracture pieces, the impact on performance may become significant. To avoid performance drops the following tips can be used:Fracture物体虽然是比较便宜的类型，但是在断片数量较多的情况下，对性能的影响可能会比较大。为避免性能下降，可以使用以下提示：

• Use volume threshold parameter to reduce the number of fracture pieces.Volume Threshold参数以减少断裂件的数量。
• Remove the pieces of a fractured body from the scene.从场景中移除骨折的物体碎片。

A code-based example, illustrating how to remove (fade with the time) the fracture pieces from the scene can be found in the Physics section of the UnigineScript samples.一个基于代码的示例，说明了如何从场景中移除（随着时间的推移逐渐消失）碎片，可以在 Physics 部分找到UnigineScript 示例.

## Assigning a Fracture Body分配Fracture物体#

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

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

4. Set body's name and change other parameters if necessary.如有必要，设置物体的名称并更改其他参数。