Switch to [u32; DIM] instead of Point<u32> for element indices.
This commit is contained in:
@@ -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);
|
||||
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) {
|
||||
for (vertices, indices) in vhacd.compute_exact_convex_hulls(&vertices, &indices) {
|
||||
if let Some(convex) = ColliderShape::convex_mesh(vertices, &indices) {
|
||||
compound_parts.push(convex);
|
||||
}
|
||||
|
||||
@@ -24,18 +24,18 @@ pub fn init_world(testbed: &mut Testbed) {
|
||||
Point3::new(-width, -width, width),
|
||||
];
|
||||
let idx = vec![
|
||||
Point3::new(0, 1, 2),
|
||||
Point3::new(0, 2, 3),
|
||||
Point3::new(4, 5, 6),
|
||||
Point3::new(4, 6, 7),
|
||||
Point3::new(0, 4, 7),
|
||||
Point3::new(0, 7, 3),
|
||||
Point3::new(1, 5, 6),
|
||||
Point3::new(1, 6, 2),
|
||||
Point3::new(3, 2, 7),
|
||||
Point3::new(2, 6, 7),
|
||||
Point3::new(0, 1, 5),
|
||||
Point3::new(0, 5, 4),
|
||||
[0, 1, 2],
|
||||
[0, 2, 3],
|
||||
[4, 5, 6],
|
||||
[4, 6, 7],
|
||||
[0, 4, 7],
|
||||
[0, 7, 3],
|
||||
[1, 5, 6],
|
||||
[1, 6, 2],
|
||||
[3, 2, 7],
|
||||
[2, 6, 7],
|
||||
[0, 1, 5],
|
||||
[0, 5, 4],
|
||||
];
|
||||
|
||||
// Dynamic box rigid body.
|
||||
|
||||
Reference in New Issue
Block a user