diff options
author | Lyuma <xn.lyuma@gmail.com> | 2023-02-23 03:03:04 +0100 |
---|---|---|
committer | Lyuma <xn.lyuma@gmail.com> | 2023-02-23 03:03:04 +0100 |
commit | cb35471cb0e0900780d8f6dbae48d1f4ca154709 (patch) | |
tree | d7dd28e9b713b97a232989d9c61ffe324ade434c /editor | |
parent | 19c9fd6926b958016d562e3b2e93b0e9480300f5 (diff) |
import: Pass the correct defaults to generated collision shapes.
Solves incorrect defaults, as well as applied scale failing to apply.
The default values are removed, and they differ from collision shape defaults
These values must match the defaults defined in resource_importer_scene.cpp
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import/resource_importer_scene.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index d6d83a45d3..a0fb95daa7 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -410,6 +410,8 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh> box.instantiate(); if (p_options.has(SNAME("primitive/size"))) { box->set_size(p_options[SNAME("primitive/size")].operator Vector3() * p_applied_root_scale); + } else { + box->set_size(Vector3(2, 2, 2) * p_applied_root_scale); } Vector<Ref<Shape3D>> shapes; @@ -421,6 +423,8 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh> sphere.instantiate(); if (p_options.has(SNAME("primitive/radius"))) { sphere->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale); + } else { + sphere->set_radius(1.0f * p_applied_root_scale); } Vector<Ref<Shape3D>> shapes; @@ -431,9 +435,13 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh> cylinder.instantiate(); if (p_options.has(SNAME("primitive/height"))) { cylinder->set_height(p_options[SNAME("primitive/height")].operator float() * p_applied_root_scale); + } else { + cylinder->set_height(1.0f * p_applied_root_scale); } if (p_options.has(SNAME("primitive/radius"))) { cylinder->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale); + } else { + cylinder->set_radius(1.0f * p_applied_root_scale); } Vector<Ref<Shape3D>> shapes; @@ -444,9 +452,13 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh> capsule.instantiate(); if (p_options.has(SNAME("primitive/height"))) { capsule->set_height(p_options[SNAME("primitive/height")].operator float() * p_applied_root_scale); + } else { + capsule->set_height(1.0f * p_applied_root_scale); } if (p_options.has(SNAME("primitive/radius"))) { capsule->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale); + } else { + capsule->set_radius(1.0f * p_applied_root_scale); } Vector<Ref<Shape3D>> shapes; |