summaryrefslogtreecommitdiffstats
path: root/scene/3d
diff options
context:
space:
mode:
authorAndreaCatania <info@andreacatania.com>2021-08-22 18:19:13 +0200
committerAndreaCatania <info@andreacatania.com>2021-08-28 08:34:15 +0200
commit2d2d24a538bf958acd44c30e9291fa54c8d77164 (patch)
tree66ed3d9d388764e8d427068e3f7d6d6ac7f44504 /scene/3d
parentde0991d801210462860f510ecfbfa9f45de2e0b4 (diff)
downloadredot-engine-2d2d24a538bf958acd44c30e9291fa54c8d77164.tar.gz
Improve collision generation usability in the new 3D scene import workflow.
With this PR it's possible to add a collision during the Mesh import, directly in editor. To generate the shape is possible to chose between the following options: - Decompose Convex: The Mesh is decomposed in one or many Convex Shapes (Using the VHACD library). - Simple Convex: Is generated a convex shape that enclose the entire mesh. - Trimesh: Generate a trimesh shape using the Mesh faces. - Box: Add a primitive box shape, where you can tweak the `size`, `position`, `rotation`. - Sphere: Add a primitive sphere shape, where you can tweak the `radius`, `position`, `rotation`. - Cylinder: Add a primitive cylinder shape, where you can tweak the `height`, `radius`, `position`, `rotation`. - Capsule: Add a primitive capsule shape, where you can tweak the `height`, `radius`, `position`, `rotation`. It's also possible to chose the generated body, so you can create: - Rigid Body. - Static Body. - Area.
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/mesh_instance_3d.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index de6925244a..7e7db57af3 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -274,7 +274,8 @@ Node *MeshInstance3D::create_multiple_convex_collisions_node() {
return nullptr;
}
- Vector<Ref<Shape3D>> shapes = mesh->convex_decompose();
+ Mesh::ConvexDecompositionSettings settings;
+ Vector<Ref<Shape3D>> shapes = mesh->convex_decompose(settings);
if (!shapes.size()) {
return nullptr;
}