+2 votes


So in my project, I'm creating a mesh using SurfaceTool and then assigning it to a MeshInstance. But what I'd like to know is what I need to do in order to be able to make my player collide with it.

My player is a KinematicBody with a simple capsule mesh and CollisionShape.

Do I need to generate a CollisionShape for my mesh to be collidable as well? The documentation says that CollisionShape is an "Editor-only helper", does that mean that I'm not supposed to create it programmatically?

Please excuse me if this is a stupid question, I'm just getting started with Godot and I ran into a wall here and couldn't find anything online.

I'm using Godot 3.0-rc3

in Engine by (21 points)

2 Answers

0 votes
Best answer

Figured it out!

I added a StaticBody and a CollisionShape to the MeshInstance and I generate a Convex Polygon Shape for the collisions

var col_shape = ConcavePolygonShape.new()

Another note: This only seems to work with PRIMITIVE_TRIANGLES

Thanks to Tapio Pyrhönen on Facebook for helping me out!

by (21 points)
0 votes

I used this code to add a box, the floor level was 2 units down:

    var box_sape = BoxShape.new()
    var extents = Vector3(2.0,2.0,2.0)
    var static_body = StaticBody.new()
    var coll_shape = CollisionShape.new()

I hope it has not changed for version 3.0

by (996 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.