diff --git a/meshers/voxel_mesher.cpp b/meshers/voxel_mesher.cpp index 26a0e04..4b9bea3 100644 --- a/meshers/voxel_mesher.cpp +++ b/meshers/voxel_mesher.cpp @@ -560,13 +560,11 @@ void VoxelMesher::_bake_liquid_colors(Node *p_chunk) { } } -void VoxelMesher::build_collider(RID shape) const { - ERR_FAIL_COND(shape == RID()); +PoolVector VoxelMesher::build_collider() const { + PoolVector face_points; if (_vertices.size() == 0) - return; - - PoolVector face_points; + return face_points; if (_indices.size() == 0) { @@ -583,9 +581,7 @@ void VoxelMesher::build_collider(RID shape) const { face_points.push_back(_vertices.get((i * 4) + 2)); } - PhysicsServer::get_singleton()->shape_set_data(shape, face_points); - - return; + return face_points; } face_points.resize(_indices.size()); @@ -593,7 +589,7 @@ void VoxelMesher::build_collider(RID shape) const { face_points.set(i, _vertices.get(_indices.get(i))); } - PhysicsServer::get_singleton()->shape_set_data(shape, face_points); + return face_points; } void VoxelMesher::bake_lights(MeshInstance *node, Vector > &lights) { @@ -954,6 +950,7 @@ void VoxelMesher::_bind_methods() { ClassDB::bind_method(D_METHOD("build_mesh"), &VoxelMesher::build_mesh); ClassDB::bind_method(D_METHOD("build_mesh_into", "mesh_rid"), &VoxelMesher::build_mesh_into); + ClassDB::bind_method(D_METHOD("build_collider"), &VoxelMesher::build_collider); ClassDB::bind_method(D_METHOD("generate_normals", "flip"), &VoxelMesher::generate_normals, DEFVAL(false)); } diff --git a/meshers/voxel_mesher.h b/meshers/voxel_mesher.h index 3462200..3069372 100644 --- a/meshers/voxel_mesher.h +++ b/meshers/voxel_mesher.h @@ -97,7 +97,7 @@ public: void bake_liquid_colors(VoxelChunk *chunk); void _bake_liquid_colors(Node *p_chunk); - void build_collider(RID shape) const; + PoolVector build_collider() const; void bake_lights(MeshInstance *node, Vector > &lights);