From a4b5400a4ef4986d77f8fea40e0672daae4afdbf Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 30 Jun 2020 15:10:48 +0200 Subject: [PATCH] Fix debug collider offsets. --- world/default/voxel_chunk_default.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/world/default/voxel_chunk_default.cpp b/world/default/voxel_chunk_default.cpp index 7beef97..e447925 100644 --- a/world/default/voxel_chunk_default.cpp +++ b/world/default/voxel_chunk_default.cpp @@ -907,6 +907,8 @@ void VoxelChunkDefault::draw_debug_mdr_colliders() { continue; Transform t = get_mesh_data_resource_transform(i); + Vector3 offset = mdr->get_collision_shape_offset(i); + t.origin += offset; for (int j = 0; j < mdr->get_collision_shape_count(); ++j) { Ref shape = mdr->get_collision_shape(j); @@ -1745,6 +1747,7 @@ void VoxelChunkDefault::_build_phase_physics_process(int phase) { for (int i = 0; i < get_mesh_data_resource_count(); ++i) { Ref mdr = get_mesh_data_resource(i); + Vector3 offset = mdr->get_collision_shape_offset(i); for (int j = 0; j < mdr->get_collision_shape_count(); ++j) { Ref shape = mdr->get_collision_shape(j); @@ -1759,6 +1762,7 @@ void VoxelChunkDefault::_build_phase_physics_process(int phase) { c.body = body; c.transform = get_mesh_data_resource_transform(i); + c.transform.origin += offset; PhysicsServer::get_singleton()->body_add_shape(body, shape->get_rid());