Version: 2017.4
Hinge Joint
Rigidbody

Mesh Collider

El Mesh Collider toma un Mesh Asset y construye su Collider basado en esa malla. Es mucho más preciso para la detección de colisiones que el uso de primitivas para mallas complicadas. Los Mesh Colliders que están marcados como Convex pueden chocar con otros Mesh Colliders.

Propiedades

Property Function
Convex Tick the checkbox to enable Convex. If enabled, this Mesh Collider collides with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles.
Is Trigger If enabled, Unity uses this Collider for triggering events, and the physics engine ignores it.
Cooking Options Enable or disable the Mesh cooking options that affect how the physics engine processes Meshes.
None Disable all of the Cooking Options listed below.
Everything Enable all of the Cooking Options listed below.
Inflate Convex Mesh Allow the physics engine to increase the volume of the input Mesh, to generate a valid convex mesh.
Cook for Faster Simulation Make the physics engine cook Meshes for faster simulation. When enabled, this runs some extra steps to guarantee the resulting Mesh is optimal for run-time performance. This affects the performance of the physics queries and contacts generation. When this setting is disabled, the physics engine uses a faster cooking time instead, and produces results as fast as possible. Consequently, the cooked Mesh Collider might not be optimal.
Enable Mesh Cleaning Make the physics engine clean Meshes. When enabled, the cooking process tries to eliminate degenerate triangles of the Mesh, as well as other geometrical artifacts. This results in a Mesh that is better suited for use in collision detection and tends to produce more accurate hit points.
Weld Colocated Vertices Make the physics engine remove equal vertices in the Meshes. When enabled, the physics engine combines the vertices that have the same position. This is important for the collision feedback that happens at run time.
Material Reference to the Physics Material that determines how this Collider interacts with others.
Mesh Reference to the Mesh to use for collisions.

Detalles

El Mesh Collider construye su representación de colisión desde Mesh adjunta al GameObject, y lee las propiedades del Transform adjunta para establecer su posición y escala correctamente. El beneficio de esto es que puede hacer que la forma del Collider sea exactamente igual a la forma del la Malla visible para el GameObject, lo que resulta en colisiones más precisas y auténticas. Sin embargo, esta precisión conlleva una mayor sobrecarga de procesamiento que las colisiones que involucran colisionadores primitivos (como Sphere, Box y Capsule), por lo que es mejor usar Mesh Colliders con moderación.

Caras en mallas de colisión son unilaterales. Esto significa que los objetos pueden pasar a través de ellos desde una dirección, pero chocan con ellos desde la otra dirección.

Mesh cooking

Mesh cooking changes a normal Mesh into a Mesh that you can use in the physics engine. Cooking builds the spatial search structures for the physics queries, such as Physics.Raycast, as well as supporting structures for the contacts generation. Unity cooks all Meshes before using them in collision detection. This can happen at import time (Import Settings > Model > Generate Colliders) or at run time.

When generating Meshes at run time (for example, for procedural surfaces), it’s useful to set the Cooking Options to produce results faster, and disable the additional data cleaning steps of cleaning. The downside is that you need to generate no degenerate triangles and no co-located vertices, but the cooking works faster.

If you disable Enable Mesh Cleaning or Weld Colocated Vertices, you need to ensure you aren’t using data that those algorithms would otherwise filter. Make sure you don’t have any co-located vertices if Weld Colocated Vertices is disabled, and when Enable Mesh Cleaning is enabled, make sure there are no tiny triangles whose area is close to zero, no thin triangles, and no huge triangles whose area is close to infinity.

Note: Setting Cooking Options to any other value than the default settings means the Mesh Collider must use a Mesh that has an isReadable value of true.

Limitaciones

Hay algunas limitaciones al usar el Mesh Collider:

  • Los Mesh Colliders que no tienen habilitado Convex solo son compatibles con GameObjects sin un componente Rigidbody. Para aplicar un Mesh Collider a un componente Rigidbody, marque la casilla de verificación Convex.
  • En ciertos casos, para que un acoplador de malla funcione correctamente, debe marcar la casilla de verificación Read/Write Enabled en los Mesh Import Settings. Estos casos incluyen:
    • Escala negativa (por ejemplo, (–1, 1, 1)).
    • Transformación de corte (por ejemplo, cuando una malla girada tiene una transformación principal escalada).

Recomendación de Optimización: Si un Mesh Collider solo utiliza una malla, puede deshabilitar Normals en los Import Settings, porque el sistema de física no los necesita.


  • 2018–06–07 Page amended with editorial review

  • Mesh Cooking Options added in 2017.3 NewIn20173

  • Updated functionality in 2018.1

Hinge Joint
Rigidbody
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961