How do I create a "Mesh Collider"?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Aaron Franke

I have a MeshInstance node with a mesh assigned. How do I create a collider from this mesh? The MeshInstance in question has a mesh that serves as terrain, so I want, for example, a ball to be able to roll down the slopes on the terrain.

:bust_in_silhouette: Reply From: Zylann

Select the MeshInstance, and look at the menu bar on top of the 3D viewport. You will see a Mesh menu. Click on it to see several options to generate the collider, for example you can try Mesh -> Create Trimesh StaticBody.

:bust_in_silhouette: Reply From: Aaron Franke

I figured out how to do it in code. C# code:

someMeshInstance.CreateTrimeshCollision();

GDScript code should look like this:

someMeshInstance.create_trimesh_collision()

Thanks to Zylann too for showing how to do it via the editor.