0 votes

Hello

I have generated a procedural 3d terrain with the SurfaceTool and now I want to add collision to it. Before 3.1 I could use "createtrimeshcollision/createconvexcollision" to generate one but after 3.1 i get that "Method 'createtrimeshcollision' is not declared in the current class".

Do any of you know how I can generate a collision mesh to my procedural terrain using GDScript?

in Engine by (12 points)

These methods still exist for Meshinstance:
https://docs.godotengine.org/en/3.1/classes/class_meshinstance.html

Does that help?

Thats how I'm using it. But gets the above error.

1 Answer

0 votes

I used MeshInstance.createtrimeshcollision(), jsut today, and it worked well:

var meshInst = MeshInstance.new()
st.begin(Mesh.PRIMITIVE_TRIANGLES)
.
.#adding vertices, uvs and stuff to SurfaceTool
.
meshInst.mesh = st.commit()
meshInst.create_trimesh_collision()

In this code the MeshInstance itself was created in code too, but you can use an existing MeshInstancetoo, of course

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