aboutsummaryrefslogtreecommitdiff
path: root/benchmarks3d/heightfield3.rs
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks3d/heightfield3.rs')
-rw-r--r--benchmarks3d/heightfield3.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/benchmarks3d/heightfield3.rs b/benchmarks3d/heightfield3.rs
index 062e7c5..3ddc0ec 100644
--- a/benchmarks3d/heightfield3.rs
+++ b/benchmarks3d/heightfield3.rs
@@ -1,6 +1,5 @@
-use na::{ComplexField, DMatrix, Point3, Vector3};
-use rapier3d::dynamics::{JointSet, RigidBodyBuilder, RigidBodySet};
-use rapier3d::geometry::{ColliderBuilder, ColliderSet};
+use na::ComplexField;
+use rapier3d::prelude::*;
use rapier_testbed3d::Testbed;
pub fn init_world(testbed: &mut Testbed) {
@@ -14,7 +13,7 @@ pub fn init_world(testbed: &mut Testbed) {
/*
* Ground
*/
- let ground_size = Vector3::new(200.0, 1.0, 200.0);
+ let ground_size = vector![200.0, 1.0, 200.0];
let nsubdivs = 20;
let heights = DMatrix::from_fn(nsubdivs + 1, nsubdivs + 1, |i, j| {
@@ -34,7 +33,7 @@ pub fn init_world(testbed: &mut Testbed) {
let rigid_body = RigidBodyBuilder::new_static().build();
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::heightfield(heights, ground_size).build();
- colliders.insert(collider, handle, &mut bodies);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
/*
* Create the cubes
@@ -55,15 +54,17 @@ pub fn init_world(testbed: &mut Testbed) {
let z = k as f32 * shift - centerz;
// Build the rigid body.
- let rigid_body = RigidBodyBuilder::new_dynamic().translation(x, y, z).build();
+ let rigid_body = RigidBodyBuilder::new_dynamic()
+ .translation(vector![x, y, z])
+ .build();
let handle = bodies.insert(rigid_body);
if j % 2 == 0 {
let collider = ColliderBuilder::cuboid(rad, rad, rad).build();
- colliders.insert(collider, handle, &mut bodies);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
} else {
let collider = ColliderBuilder::ball(rad).build();
- colliders.insert(collider, handle, &mut bodies);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
}
}
}
@@ -73,5 +74,5 @@ pub fn init_world(testbed: &mut Testbed) {
* Set up the testbed.
*/
testbed.set_world(bodies, colliders, joints);
- testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
+ testbed.look_at(point![100.0, 100.0, 100.0], Point::origin());
}