+2 votes

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.

in Engine by (103 points)

2 Answers

+1 vote
Best answer

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.

by (103 points)
+4 votes

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.

by (27,958 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.