aboutsummaryrefslogtreecommitdiff
path: root/benchmarks2d/convex_polygons2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks2d/convex_polygons2.rs')
-rw-r--r--benchmarks2d/convex_polygons2.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/benchmarks2d/convex_polygons2.rs b/benchmarks2d/convex_polygons2.rs
index 99f5a14..6c9792e 100644
--- a/benchmarks2d/convex_polygons2.rs
+++ b/benchmarks2d/convex_polygons2.rs
@@ -1,8 +1,6 @@
-use na::Point2;
use rand::distributions::{Distribution, Standard};
use rand::{rngs::StdRng, SeedableRng};
-use rapier2d::dynamics::{JointSet, RigidBodyBuilder, RigidBodySet};
-use rapier2d::geometry::{ColliderBuilder, ColliderSet};
+use rapier2d::prelude::*;
use rapier_testbed2d::Testbed;
pub fn init_world(testbed: &mut Testbed) {
@@ -21,23 +19,23 @@ pub fn init_world(testbed: &mut Testbed) {
let rigid_body = RigidBodyBuilder::new_static().build();
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::cuboid(ground_size, 1.2).build();
- colliders.insert(collider, handle, &mut bodies);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
let rigid_body = RigidBodyBuilder::new_static()
.rotation(std::f32::consts::FRAC_PI_2)
- .translation(ground_size, ground_size * 2.0)
+ .translation(vector![ground_size, ground_size * 2.0])
.build();
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::cuboid(ground_size * 2.0, 1.2).build();
- colliders.insert(collider, handle, &mut bodies);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
let rigid_body = RigidBodyBuilder::new_static()
.rotation(std::f32::consts::FRAC_PI_2)
- .translation(-ground_size, ground_size * 2.0)
+ .translation(vector![-ground_size, ground_size * 2.0])
.build();
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::cuboid(ground_size * 2.0, 1.2).build();
- colliders.insert(collider, handle, &mut bodies);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
/*
* Create the convex polygons
@@ -58,18 +56,20 @@ pub fn init_world(testbed: &mut Testbed) {
let x = i as f32 * shift - centerx;
let y = j as f32 * shift * 2.0 + centery + 2.0;
- let rigid_body = RigidBodyBuilder::new_dynamic().translation(x, y).build();
+ let rigid_body = RigidBodyBuilder::new_dynamic()
+ .translation(vector![x, y])
+ .build();
let handle = bodies.insert(rigid_body);
let mut points = Vec::new();
for _ in 0..10 {
- let pt: Point2<f32> = distribution.sample(&mut rng);
+ let pt: Point<f32> = distribution.sample(&mut rng);
points.push(pt * scale);
}
let collider = ColliderBuilder::convex_hull(&points).unwrap().build();
- colliders.insert(collider, handle, &mut bodies);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
}
}
@@ -77,5 +77,5 @@ pub fn init_world(testbed: &mut Testbed) {
* Set up the testbed.
*/
testbed.set_world(bodies, colliders, joints);
- testbed.look_at(Point2::new(0.0, 50.0), 10.0);
+ testbed.look_at(point![0.0, 50.0], 10.0);
}