diff options
| author | Crozet Sébastien <developer@crozet.re> | 2021-01-20 15:40:00 +0100 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2021-01-20 15:40:00 +0100 |
| commit | 28b7866aee68ca844406bea4761d630a7913188d (patch) | |
| tree | c664c3dae65e5300f606e4f8cfb1198023173ea6 /examples3d/convex_decomposition3.rs | |
| parent | e2006599a8fa90090393ff4fed326ee78fd7c0b7 (diff) | |
| download | rapier-28b7866aee68ca844406bea4761d630a7913188d.tar.gz rapier-28b7866aee68ca844406bea4761d630a7913188d.tar.bz2 rapier-28b7866aee68ca844406bea4761d630a7913188d.zip | |
Switch to [u32; DIM] instead of Point<u32> for element indices.
Diffstat (limited to 'examples3d/convex_decomposition3.rs')
| -rw-r--r-- | examples3d/convex_decomposition3.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/examples3d/convex_decomposition3.rs b/examples3d/convex_decomposition3.rs index 2e35f43..abd2fe0 100644 --- a/examples3d/convex_decomposition3.rs +++ b/examples3d/convex_decomposition3.rs @@ -1,5 +1,5 @@ use kiss3d::loader::obj; -use na::{Isometry3, Point3, Translation3}; +use na::{Point3, Translation3}; use rapier3d::cdl::bounding_volume::{self, BoundingVolume}; use rapier3d::cdl::transformation::vhacd::{VHACDParameters, VHACD}; use rapier3d::dynamics::{JointSet, RigidBodyBuilder, RigidBodySet}; @@ -74,11 +74,16 @@ pub fn init_world(testbed: &mut Testbed) { trimesh.scale_by_scalar(6.0 / diag); let params = VHACDParameters::default(); - let vertices = &trimesh.coords; - let indices = &trimesh.indices.unwrap_unified(); - let vhacd = VHACD::decompose(¶ms, vertices, indices, true); - - for (vertices, indices) in vhacd.compute_exact_convex_hulls(vertices, indices) { + let vertices = trimesh.coords; + let indices: Vec<_> = trimesh + .indices + .unwrap_unified() + .into_iter() + .map(|idx| [idx.x, idx.y, idx.z]) + .collect(); + let vhacd = VHACD::decompose(¶ms, &vertices, &indices, true); + + for (vertices, indices) in vhacd.compute_exact_convex_hulls(&vertices, &indices) { if let Some(convex) = ColliderShape::convex_mesh(vertices, &indices) { compound_parts.push(convex); } |
