From 684b7fdf47da90d19107ffa03f45cd6f5d35d8d3 Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Tue, 18 Jan 2022 16:30:41 +0100 Subject: [PATCH] Fix "Convert to MeshLibrary" not respecting collision transforms (cherry picked from commit 025d7b933266901f49c05922e85b70dd9b3b8b19) --- editor/plugins/mesh_library_editor_plugin.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 5d8f0074622..7bcd89cae84 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -136,9 +136,11 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library, continue; } - //Transform shape_transform = sb->shape_owner_get_transform(E->get()); - - //shape_transform.set_origin(shape_transform.get_origin() - phys_offset); + Transform shape_transform; + if (p_apply_xforms) { + shape_transform = mi->get_transform(); + } + shape_transform *= sb->get_transform() * sb->shape_owner_get_transform(E->get()); for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) { Ref collision = sb->shape_owner_get_shape(E->get(), k); @@ -147,7 +149,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library, } MeshLibrary::ShapeData shape_data; shape_data.shape = collision; - shape_data.local_transform = sb->get_transform() * sb->shape_owner_get_transform(E->get()); + shape_data.local_transform = shape_transform; collisions.push_back(shape_data); } }