Mesh Collider component reference
The Mesh Collider takes a Mesh Asset and builds its Collider An invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh — a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary based on that Mesh. It is more accurate for collision A collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary detection than using primitives for complicated Meshes. Mesh Colliders that are marked as Convex can collide with other Mesh Colliders.
Properties
| Property | Function | |
|---|---|---|
| Convex | Enable the checkbox to make the Mesh Collider collide with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles. | |
| Is Trigger | Enable this checkbox to make Unity use this Collider for triggering events, and the physics engine A system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info See in Glossary ignore it. |
|
| Cooking Options | Enable or disable the Mesh cooking options that affect how the physics engine processes Meshes. | |
| None | Disables all of the Cooking Options listed below. | |
| Everything | Enables all of the Cooking Options listed below. | |
| Cook for Faster Simulation | Makes 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 | Makes 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 An automatic process performed by Unity which determines whether a moving GameObject with a Rigidbody and collider component has come into contact with any other colliders. More info See in Glossary and tends to produce more accurate hit points. |
|
| Weld Colocated Vertices | Makes 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. | |
| Use Fast Midphase | Makes the physics engine use the fastest mid-phase acceleration structure and algorithm available for your output platform. When you enable this option, the physics engine uses a faster algorithm that doesn’t require any R-Trees for spatial access. If you encounter mid-phase issues at runtime on some platform, you can still disable this option to use the slower legacy mid-phase algorithm instead. | |
| Material An asset that defines how a surface should be rendered. More info See in Glossary |
Reference to the Physics Material that determines how this Collider interacts with others. | |
| Mesh The main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info See in Glossary |
Reference to the Mesh to use for collisions. | |
Details
The Mesh Collider builds its collision representation from the Mesh attached to the GameObject The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary , and reads the properties of the attached Transform to set its position and scale correctly. The benefit of this is that you can make the shape of the Collider exactly the same as the shape of the visible Mesh for the GameObject, which creates more precise and authentic collisions. However, this precision comes with a higher processing overhead than collisions involving primitive colliders (such as Sphere, Box, and Capsule), so it is best to use Mesh Colliders sparingly.
Faces in collision meshes are one-sided. This means GameObjects can pass through them from one direction, but collide with them from the other.
Details about underlying algorithms and data structures used by mesh colliders can be found at PhysX documentation.
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 you generate 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 you have disabled Weld Colocated Vertices, and when you enable Enable Mesh Cleaning, 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: When you set the Cooking Options to any other value than the default settings, it means the Mesh Collider must use a Mesh that has an isReadable value of true .
Limitations
There are some limitations when using the Mesh Collider:
GameObjects that have a Rigidbody A component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary component only support Mesh Colliders that have Convex option enabled: the physics engine can only simulate convex mesh colliders.
For a Mesh Collider to work properly, the Mesh must be read/write enabled in any of these circumstances:
- The Mesh Collider’s Transform has negative scaling (for example, (–1, 1, 1)) and the Mesh is convex.
- The Mesh Collider’s transform is skewed or sheared (for example, when a rotated transform has a scaled parent transform).
- The Mesh Collider’s Cooking Options flags are set to any value other than the default.
You should not modify mesh geometry that is used for colliders because the physics engine has to rebuild an internal mesh collision acceleration structure every time you change the mesh. This causes a substantial performance overhead. For meshes that need to collide and change at runtime, it is often better to approximate the mesh shape with primitive colliders like capsules, spheres and boxes.
Optimization tip: If a Mesh Collider only uses a Mesh, you can disable Normals The direction perpendicular to the surface of a mesh, represented by a Vector. Unity uses normals to determine object orientation and apply shading. More info
See in Glossary in Import Settings, because the physics system doesn’t need them.
Updated Mesh Collider limitations in 2018.3
2018–10–12 Page amended
Mesh Cooking Options added in 2017.3 NewIn20173
Updated functionality in 2018.1
Updated limitations relating to read/write enabled setting in 2017.3
Inflate Convex Mesh deprecated in 2018.3 because the new convex hull computation algorithm (Quickhull) is more tolerant towards imperfections in the input mesh.
Mesh Collider component reference
The Mesh Collider takes a Mesh Asset and builds its Collider An invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh — a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary based on that Mesh. It is more accurate for collision A collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary detection than using primitives for complicated Meshes. Mesh Colliders that are marked as Convex can collide with other Mesh Colliders.

Properties
| Property | Function | |
|---|---|---|
| Convex | Enable the checkbox to make the Mesh Collider collide with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles. | |
| Is Trigger | Enable this checkbox to make Unity use this Collider for triggering events, and the physics engine A system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info See in Glossary ignore it. |
|
| Cooking Options | Enable or disable the Mesh cooking options that affect how the physics engine processes Meshes. | |
| None | Disables all of the Cooking Options listed below. | |
| Everything | Enables all of the Cooking Options listed below. | |
| Cook for Faster Simulation | Makes 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 | Makes 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 An automatic process performed by Unity which determines whether a moving GameObject with a Rigidbody and collider component has come into contact with any other colliders. More info See in Glossary and tends to produce more accurate hit points. |
|
| Weld Colocated Vertices | Makes 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. | |
| Use Fast Midphase | Makes the physics engine use the fastest mid-phase acceleration structure and algorithm available for your output platform. When you enable this option, the physics engine uses a faster algorithm that doesn’t require any R-Trees for spatial access. If you encounter mid-phase issues at runtime on some platform, you can still disable this option to use the slower legacy mid-phase algorithm instead. | |
| Material An asset that defines how a surface should be rendered. More info See in Glossary |
Reference to the Physics Material that determines how this Collider interacts with others. | |
| Mesh The main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info See in Glossary |
Reference to the Mesh to use for collisions. | |
Details
The Mesh Collider builds its collision representation from the Mesh attached to the GameObject The fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary , and reads the properties of the attached Transform to set its position and scale correctly. The benefit of this is that you can make the shape of the Collider exactly the same as the shape of the visible Mesh for the GameObject, which creates more precise and authentic collisions. However, this precision comes with a higher processing overhead than collisions involving primitive colliders (such as Sphere, Box, and Capsule), so it is best to use Mesh Colliders sparingly.
Faces in collision meshes are one-sided. This means GameObjects can pass through them from one direction, but collide with them from the other.
Details about underlying algorithms and data structures used by mesh colliders can be found at PhysX documentation.
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 you generate 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 you have disabled Weld Colocated Vertices, and when you enable Enable Mesh Cleaning, 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: When you set the Cooking Options to any other value than the default settings, it means the Mesh Collider must use a Mesh that has an isReadable value of true .
Limitations
There are some limitations when using the Mesh Collider:
GameObjects that have a Rigidbody A component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary component only support Mesh Colliders that have Convex option enabled: the physics engine can only simulate convex mesh colliders.
For a Mesh Collider to work properly, the Mesh must be read/write enabled in any of these circumstances:
- The Mesh Collider’s Transform has negative scaling (for example, (–1, 1, 1)) and the Mesh is convex.
- The Mesh Collider’s transform is skewed or sheared (for example, when a rotated transform has a scaled parent transform).
- The Mesh Collider’s Cooking Options flags are set to any value other than the default.
You should not modify mesh geometry that is used for colliders because the physics engine has to rebuild an internal mesh collision acceleration structure every time you change the mesh. This causes a substantial performance overhead. For meshes that need to collide and change at runtime, it is often better to approximate the mesh shape with primitive colliders like capsules, spheres and boxes.
Optimization tip: If a Mesh Collider only uses a Mesh, you can disable Normals The direction perpendicular to the surface of a mesh, represented by a Vector. Unity uses normals to determine object orientation and apply shading. More info
See in Glossary in Import Settings, because the physics system doesn’t need them.
Updated Mesh Collider limitations in 2018.3
2018–10–12 Page amended
Mesh Cooking Options added in 2017.3 NewIn20173
Updated functionality in 2018.1
Updated limitations relating to read/write enabled setting in 2017.3
Inflate Convex Mesh deprecated in 2018.3 because the new convex hull computation algorithm (Quickhull) is more tolerant towards imperfections in the input mesh.
Mesh Collider
The Mesh Collider takes a Mesh Asset and builds its Collider based on that mesh. It is far more accurate for collision detection than using primitives for complicated meshes. Mesh Colliders that are marked as Convex can collide with other Mesh Colliders.

Properties
| Property: | Function: |
|---|---|
| Is Trigger | If enabled, this Collider is used for triggering events, and is ignored by the physics engine. |
| Material | Reference to the Physics Material that determines how this Collider interacts with others. |
| Mesh | Reference to the Mesh to use for collisions. |
| Convex | If enabled, this Mesh Collider will collide with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles. |
Details
The Mesh Collider builds its collision representation from the Mesh attached to the GameObject, and reads the properties of the attached Transform to set its position and scale correctly. The benefit of this is that the shape of the collider can be exactly the same as the shape of the visible mesh for the object, resulting in more precise and authentic collisions. However, this precision comes with a higher processing overhead than collisions involving primitive colliders (sphere, box, capsule) and so it is best to use Mesh Colliders sparingly.
Collision meshes use backface culling. If an object collides with a mesh that will be backface culled graphically it will also not collide with it physically.
There are some limitations when using the Mesh Collider. Non-convex Mesh Colliders are only supported on GameObjects without a rigidbody. If you want to use a Mesh Collider on a rigidbody, it needs to be marked as Convex.
Note that versions of Unity before 5.0 had a Smooth Sphere Collisions property for the Mesh Collider in order to improve interactions between meshes and spheres. This property is now obsolete since the smooth interaction is standard behaviour for the physics engine and there is no particular advantage in switching it off.
Mesh Collider
Mesh Collider берет Mesh Asset и строит его Коллайдер Невидимая форма, используемая для обработки физических столкновений объекта. Коллайдер не обязательно должен быть точно такой же формы, как сетка объекта — грубое приближение часто бывает более эффективным и неразличимым в игровом процессе. Подробнее
См. в Словарь на основе этой сетки. Это более точно для коллизии Столкновение происходит, когда физический движок обнаруживает, что коллайдеры двух игровых объектов соприкасаются или перекрываются, когда по крайней мере один имеет компонент Rigidbody и находится в движении. Подробнее
См. в обнаружении Словарь , чем использование примитивов для сложных мешей. Коллайдеры сетки, помеченные как Выпуклые, могут конфликтовать с другими коллайдерами сетки.

Свойства
| Свойства | Функции | |
|---|---|---|
| Convex | Установите флажок, чтобы Mesh Collider сталкивался с другими Mesh Collider. Выпуклые коллайдеры сетки ограничены 255 треугольниками. | |
| Is Trigger | Установите этот флажок, чтобы Unity использовала этот коллайдер для запуска событий и физический движок систему, моделирующую аспекты физических систем, чтобы объекты могут правильно ускоряться и подвергаться воздействию столкновений, гравитации и других сил. Подробнее См. в Словарь игнорировать. |
|
| Cooking Options | Включите или отключите параметры приготовления сетки, которые влияют на то, как физический движок обрабатывает сетки. | |
| None | Отключает все перечисленные ниже параметры приготовления. | |
| Everything | Включает все перечисленные ниже варианты приготовления. | |
| Cook for Faster Simulation | Заставляет физический движок готовить сетки для более быстрого моделирования. Когда эта функция включена, выполняется несколько дополнительных шагов, чтобы гарантировать, что результирующая сетка оптимальна для производительности во время выполнения. Это влияет на производительность физических запросов и генерации контактов. Когда этот параметр отключен, физический движок вместо этого использует более быстрое время приготовления и выдает результаты как можно быстрее. Следовательно, приготовленный Mesh Collider может быть не оптимальным. | |
| Enable Mesh Cleaning | Делает физический движок чистым Meshes. Если этот параметр включен, процесс приготовления пытается устранить вырожденные треугольники сетки, как а также другие геометрические артефакты. В результате получается сетка, которая лучше подходит для использования в обнаружении столкновений автоматическом процессе, выполняемом Unity, который определяет, движется ли игровой объект с компонент Rigidbody и коллайдер вступил в контакт с любыми другими коллайдерами. Подробнее См. в Словарь и дает более точные очки жизни. |
|
| Weld Colocated Vertices | Заставляет физический движок удалять одинаковые вершины в мешах. Когда включено, физический движок объединяет вершины, имеющие одинаковое положение. Это важно для обратной связи о столкновениях, которая происходит во время выполнения. | |
| Use Fast Midphase | Заставляет физический движок использовать самую быструю структуру и алгоритм ускорения средней фазы, доступные для вашей платформы вывода. Когда вы включаете эту опцию, физический движок использует более быстрый алгоритм, который не требует никаких R-деревьев для пространственного доступа. Если вы столкнетесь с проблемами промежуточной фазы во время выполнения на какой-либо платформе, вы все равно можете отключить этот параметр, чтобы вместо этого использовать более медленный устаревший алгоритм промежуточной фазы.. | |
| Material Ресурс, определяющий, как должна отображаться поверхность. Подробнее См. в Словарь |
Ссылка на Физический материал, который определяет, как этот коллайдер взаимодействует с другими. | |
| Mesh Основной графический примитив Unity. Меши составляют большую часть ваших 3D-миров. Unity поддерживает триангулированные или четырехугольные полигональные сетки. Поверхности Nurbs, Nurms, Subdiv должны быть преобразованы в полигоны. Подробнее См. в Словарь |
Ссылка на сетку, используемую для коллизий. | |
Подробнее
Mesh Collider строит представление столкновения из Mesh, прикрепленного к GameObject Основной объект в сценах Unity, который может представлять персонажей, реквизит, декорации, камеры, путевые точки и многое другое. Функциональность GameObject определяется прикрепленными к нему компонентами. Подробнее
Смотрит в Словарь и читает свойства присоединенного Transform, чтобы правильно установить положение и масштаб. Преимущество этого заключается в том, что вы можете сделать форму коллайдера точно такой же, как форма видимой сетки для игрового объекта, что создает более точные и аутентичные столкновения. Однако эта точность связана с более высокими затратами на обработку, чем коллизии с участием примитивных коллайдеров (таких как Sphere, Box и Capsule), поэтому лучше использовать Mesh Colliders экономно.
Границы в сетках коллизий односторонние. Это означает, что игровые объекты могут проходить сквозь них с одной стороны, но сталкиваться с ними с другой.
Подробные сведения об основных алгоритмах и структурах данных, используемых коллайдерами сетки, можно найти по адресу Документация по PhysX.
Приготовление сетки
Приготовление сетки превращает обычную сетку в сетку, которую можно использовать в физическом движке. Cooking создает структуры пространственного поиска для физических запросов, такие как Physics.Raycast, а также вспомогательные структуры для генерации контактов. Unity готовит все меши, прежде чем использовать их для обнаружения столкновений. Это может произойти во время импорта (Настройки импорта > Модель > Создать коллайдеры) или во время выполнения.
При создании мешей во время выполнения (например, для процедурных поверхностей) полезно настроить Параметры приготовления для более быстрого получения результатов и отключить дополнительные этапы очистки данных при очистке. Недостатком является то, что вам не нужно генерировать вырожденные треугольники и совмещенные вершины, но готовка работает быстрее.
Если вы отключите Включить очистку сетки или Объединить совмещенные вершины, вам необходимо убедиться, что вы не используете данные, которые эти алгоритмы в противном случае отфильтровали бы. Убедитесь, что у вас нет совмещенных вершин, если вы отключили Объединять совмещенные вершины, а когда вы включите Включить очистку сетки, убедитесь, что нет крошечных треугольников, чьи площадь близка к нулю, нет тонких треугольников и нет огромных треугольников, площадь которых близка к бесконечности.
Примечание. Когда вы устанавливаете для параметра Cooking Options любое значение, отличное от настроек по умолчанию, это означает, что Mesh Collider должен использовать Mesh с isReadable значение true .
Ограничения
Есть некоторые ограничения при использовании Mesh Collider:
Игровые объекты с жестким телом Компонент, позволяющий воздействовать на игровой объект смоделированной гравитацией и другими силами. Подробнее
См. в компоненте Словарь поддерживаются только те коллайдеры сетки, которые имеют выпуклость опция включена: физический движок может моделировать только коллайдеры выпуклой сетки.
Чтобы Mesh Collider работал правильно, Mesh должен быть включен для чтения/записи при любом из следующих обстоятельств:
- Преобразование Mesh Collider имеет отрицательное масштабирование (например, (–1, 1, 1)) и сетка выпуклая.
- Преобразование Mesh Collider перекошено или сдвинуто (например, когда повернутое преобразование имеет масштабированное родительское преобразование).
- Флаги Cooking Options Mesh Collider устанавливаются на любое значение, кроме значения по умолчанию.
Не следует изменять геометрию сетки, которая используется для коллайдеров, потому что физический движок должен перестраивать внутреннюю структуру ускорения столкновений сетки каждый раз, когда вы меняете сетку. Это приводит к существенному снижению производительности. Для сеток, которые должны сталкиваться и изменяться во время выполнения, часто лучше аппроксимировать форму сетки с помощью примитивных коллайдеров, таких как капсулы, сферы и коробки.
Совет по оптимизации. Если Mesh Collider использует только Mesh, вы можете отключить Normals Направление, перпендикулярное поверхность сетки, представленная вектором. Unity использует нормали для определения ориентации объекта и применения затенения. Подробнее
См. в Словарь в Настройках импорта, поскольку физической системе они не нужны.