Hinge Joint
Rigidbody
Other Versions

Mesh Collider

Switch to Scripting

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 Tick the checkbox to enable Convex. If enabled, this Mesh Collider collides 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 you can make the shape of the Collider exactly the same as the shape of the visible Mesh for the GameObject, resulting in 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) and so it is best to use Mesh Colliders sparingly.

Faces in collision meshes are one-sided. This means objects can pass through them from one direction, but collide with them from the other.

There are some limitations when using the Mesh Collider:

  • Mesh Colliders that do not have Convex enabled are only supported on GameObjects without a Rigidbody component. To apply a Mesh Collider to a Rigidbody component, tick the Convex checkbox.
  • In certain cases, for a Mesh Collider to work properly, you need to tick the Read/Write Enabled checkbox in the Mesh Import Settings. These cases include:
    • Negative scaling (for example, (–1, 1, 1)).
    • Shear transform (for example, when a rotated Mesh has a scaled parent transform).

Optimization tip: If a Mesh is used only by a Mesh Collider, you can disable Normals in Import Settings, because the physics system doesn’t need them.

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 because the smooth interaction is standard behaviour for the physics engine, and there is no particular advantage in switching it off.

Hinge Joint
Rigidbody