Double-sided mesh colliders?

Simple question…is there functionality in the physics engine for this? Worst-case scenario if not, I create two copies of my mesh geometry with different normals. That seems wasteful though. And more work for me :slight_smile:

Duplicate and flip the polygons that should have two sides. The winding order of vertices in polygons determines what’s inside and outside, so there’s no way around it.

You can do this to duplicate and flip every mesh in the scene temporarily during runtime (so all meshes will become two sided). It works assuming all of your meshes use triangles, which you can uncheck “Keep Quads” in your mesh import settings to sometimes avoid this being an issue.

In practice you should only do this on a few meshes max since it doubles the number of triangles on each mesh.

using System.Linq;

// (other code, put the Start() below into a MonoBehavior class)

void Start()
    {
            foreach (MeshFilter meshFilter in GameObject.FindObjectsOfType<MeshFilter>())
            {
                meshFilter.mesh.SetIndices(meshFilter.mesh.GetIndices(0).Concat(meshFilter.mesh.GetIndices(0).Reverse()).ToArray(), MeshTopology.Triangles, 0);
            }
    }