---
title: "Collision mesh in Unity: Mesh Collider and primitives"
description: "Give a Unity model collision with Box, Sphere or Capsule colliders, or a Mesh Collider that uses a simple mesh. Tick Convex for any moving Rigidbody."
canonical: https://appliedmanifold.com/mesh/collision-mesh-unity/
site: "Applied Manifold: The spatial compute cloud for 3D reality"
---

1.  [Home](https://appliedmanifold.com/)
2.  [meshfx](https://appliedmanifold.com/mesh/)
3.  Collision in Unity

meshfx // COLLISION // UNITY

# How to add a collision mesh in Unity

In Unity you give a model collision by adding a collider: Box, Sphere or Capsule colliders for simple shapes, or a Mesh Collider that uses a mesh you choose. Assign a simplified collision mesh rather than the render mesh, and tick Convex on any Mesh Collider attached to a Rigidbody that physics moves.

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys) [meshfx docs →](https://appliedmanifold.com/docs/mesh/)

pyrofx effects work today, and new accounts start with $5 of usage.

**MODULE // meshfx AVAILABLE**

meshfx measures faults, checks repairs and makes LODs for a triangle budget. meshfx runs on the hosted API: try it in the [Playground](https://appliedmanifold.com/playground/).

-   Primitives: Box, Sphere, Capsule
-   Mesh Collider with its own mesh
-   Convex: 255 triangles at most

01 // BY HAND

## Add a Mesh Collider with its own mesh

1.  Model a low-poly collision mesh in your 3D editor that wraps the object, and export it in the same FBX as `Crate_Collision`, or as its own file.
2.  Import the FBX and select the GameObject that should collide.
3.  Click Add Component > Physics > Mesh Collider.
4.  Drag the collision mesh asset into the Mesh Collider's Mesh field, then disable the renderer on the collision mesh if it came in as a visible child.
5.  Tick Convex if the object has a Rigidbody that physics moves.
6.  Enter Play mode and check the outline in the Scene view, where colliders draw as green wireframes.

02 // PRIMITIVES

## Use primitive colliders where they fit

Box, Sphere and Capsule colliders are the cheapest shapes in Unity's physics. A barrel is a Capsule, a crate is a Box, and a table can be several Box colliders on child objects under one Rigidbody (a compound collider).

The Generate Colliders checkbox in the model import settings adds a Mesh Collider made from the render mesh to every mesh in the file. Use it for static level geometry, where an exact shape is fine because nothing moves.

03 // CONVEX

## Why Convex matters

A convex Mesh Collider wraps the mesh with no dents, which lets moving objects test against each other quickly. Unity limits a convex Mesh Collider to 255 triangles, so it builds a simpler hull from a dense mesh. A Mesh Collider without Convex works only on static or kinematic objects.

AddCollision.cs

```
using UnityEngine;

public class AddCollision : MonoBehaviour
{
    [SerializeField] Mesh collisionMesh;

    void Awake()
    {
        var col = gameObject.AddComponent<MeshCollider>();
        col.sharedMesh = collisionMesh;
        col.convex = GetComponent<Rigidbody>() != null;
    }
}
```

04 // meshfx

## meshfx for collision in unity

meshfx measures faults, checks repairs and makes LODs. Build physics shapes in your engine or editor. Hosted meshfx runs are available in the Playground.

05 // RELATED

## Related pages

-   [Collision in Godot 4 AvailableAdd collision in Godot 4 with Create Collision Shape or -col and -colonly import suffixes, and pick trimesh or convex shapes.](https://appliedmanifold.com/mesh/collision-mesh-godot/)
-   [Collision in Unreal AvailableAdd collision in Unreal Engine 5 with simple shapes, Auto Convex Collision or UCX\_ meshes, and set simple and complex collision.](https://appliedmanifold.com/mesh/collision-mesh-unreal/)
-   [LOD in Unity AvailableSet up a LOD Group in Unity by hand or from \_LOD suffixes in an FBX, pick switch points, and cross-fade between levels.](https://appliedmanifold.com/mesh/lod-unity/)
-   [Unity polycount AvailableUnity's 65,535-vertex index limit, when to switch to 32-bit indices, starting budgets, and where to read the polycount.](https://appliedmanifold.com/mesh/polycount-unity/)
-   [Collision mesh AvailableA collision mesh is a simple invisible shape that physics uses in place of the detailed model, for fast, stable collisions.](https://appliedmanifold.com/learn/collision-mesh/)
-   [Convex hull AvailableA convex hull is the tightest dent-free shape around a model, used as fast, stable collision for moving objects.](https://appliedmanifold.com/learn/convex-hull/)
-   [meshfxmeshfx reads an input model, repairs surface faults and compiles reduced GLB levels of detail for Godot, three.js or any glTF loader.](https://appliedmanifold.com/docs/mesh/)

[All pages in meshfx →](https://appliedmanifold.com/mesh/)

[← Collision in Godot 4](https://appliedmanifold.com/mesh/collision-mesh-godot/)[Collision in Unreal →](https://appliedmanifold.com/mesh/collision-mesh-unreal/)

06 // FAQ

## Unity collision questions

[All questions →](https://appliedmanifold.com/faq/)

**README.COLLISION\_MESH\_UNITY**

### Why is my Mesh Collider not working in Unity?

Check that the collider has a mesh assigned, enable Convex if attached to a moving Rigidbody and verify physics layer collisions.

### What is a Mesh Collider in Unity?

A Mesh Collider is a Unity physics component that builds a collision shape directly from an assigned mesh asset.

### How do I use a collision mesh from a 3D editor in Unity?

Export a simplified mesh from a 3D editor, assign it to the Mesh Collider component's Mesh slot and enable Convex for moving objects.

### What does Precompute Collision Geometry do in Unity?

Precompute Collision Geometry builds physics collision data during the project build instead of at runtime, reducing scene load hitches.

### How simple should a Unity collision mesh be?

Use Box, Sphere or Capsule colliders whenever possible and keep convex Mesh Colliders under Unity's 255 triangle hull limit.

## Explore meshfx outputs

Inspect compiled meshfx outputs and their reports. Hosted meshfx runs are available in the Playground.

[Get Free API Key](https://console.appliedmanifold.com/sign-in?next=/api-keys) [meshfx →](https://appliedmanifold.com/docs/mesh/)

[All effects, guides and explainers →](https://appliedmanifold.com/effects/)
