Godot 4.3
I want to make trimesh collision from MeshInstance3D in the script , but i dont know how to do that. Can someone tell me how to do that
Godot 4.3
I want to make trimesh collision from MeshInstance3D in the script , but i dont know how to do that. Can someone tell me how to do that
Try this:
func generate_trimesh_collision(mesh_instance: MeshInstance3D)
var collision = CollisionShape3D.new()
collision.shape = mesh_instance.mesh.create_trimesh_shape()
var static_body = StaticBody3D.new()
static_body.add_child(collision)
mesh_instance.add_child(static_body)
I tried implementing this code and it just gave me an error Cannot call method ‘create_trimesh_shape’ on a null value. I am also in godot 4.4 so I don’t know if the update made this not work
It means that the mesh_instance
or it’s mesh is null, please recheck your MeshInstance3D
.