Fix "Convert to MeshLibrary" not respecting collision transforms

(cherry picked from commit 025d7b9332)
This commit is contained in:
Ricardo Buring 2022-01-18 16:30:41 +01:00 committed by Rémi Verschelde
parent 92073c2fcd
commit 51911952c5
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -136,9 +136,11 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
continue; continue;
} }
//Transform shape_transform = sb->shape_owner_get_transform(E->get()); Transform shape_transform;
if (p_apply_xforms) {
//shape_transform.set_origin(shape_transform.get_origin() - phys_offset); 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++) { for (int k = 0; k < sb->shape_owner_get_shape_count(E->get()); k++) {
Ref<Shape> collision = sb->shape_owner_get_shape(E->get(), k); Ref<Shape> collision = sb->shape_owner_get_shape(E->get(), k);
@ -147,7 +149,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
} }
MeshLibrary::ShapeData shape_data; MeshLibrary::ShapeData shape_data;
shape_data.shape = collision; 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); collisions.push_back(shape_data);
} }
} }