mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Merge pull request #73797 from lyuma/import_primitive_defaults
import: Pass the correct defaults to generated collision shapes.
This commit is contained in:
@@ -410,6 +410,8 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
|
|||||||
box.instantiate();
|
box.instantiate();
|
||||||
if (p_options.has(SNAME("primitive/size"))) {
|
if (p_options.has(SNAME("primitive/size"))) {
|
||||||
box->set_size(p_options[SNAME("primitive/size")].operator Vector3() * p_applied_root_scale);
|
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;
|
Vector<Ref<Shape3D>> shapes;
|
||||||
@@ -421,6 +423,8 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
|
|||||||
sphere.instantiate();
|
sphere.instantiate();
|
||||||
if (p_options.has(SNAME("primitive/radius"))) {
|
if (p_options.has(SNAME("primitive/radius"))) {
|
||||||
sphere->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale);
|
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;
|
Vector<Ref<Shape3D>> shapes;
|
||||||
@@ -431,9 +435,13 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
|
|||||||
cylinder.instantiate();
|
cylinder.instantiate();
|
||||||
if (p_options.has(SNAME("primitive/height"))) {
|
if (p_options.has(SNAME("primitive/height"))) {
|
||||||
cylinder->set_height(p_options[SNAME("primitive/height")].operator float() * p_applied_root_scale);
|
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"))) {
|
if (p_options.has(SNAME("primitive/radius"))) {
|
||||||
cylinder->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale);
|
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;
|
Vector<Ref<Shape3D>> shapes;
|
||||||
@@ -444,9 +452,13 @@ Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<Mesh>
|
|||||||
capsule.instantiate();
|
capsule.instantiate();
|
||||||
if (p_options.has(SNAME("primitive/height"))) {
|
if (p_options.has(SNAME("primitive/height"))) {
|
||||||
capsule->set_height(p_options[SNAME("primitive/height")].operator float() * p_applied_root_scale);
|
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"))) {
|
if (p_options.has(SNAME("primitive/radius"))) {
|
||||||
capsule->set_radius(p_options[SNAME("primitive/radius")].operator float() * p_applied_root_scale);
|
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;
|
Vector<Ref<Shape3D>> shapes;
|
||||||
|
|||||||
Reference in New Issue
Block a user