aboutsummaryrefslogtreecommitdiff
path: root/examples2d
diff options
context:
space:
mode:
authorSébastien Crozet <sebcrozet@dimforge.com>2024-04-28 18:23:30 +0200
committerSébastien Crozet <sebastien@crozet.re>2024-04-30 23:10:46 +0200
commit0a9153e273dc0bdd4ba6443bd7f4dcfc671faac3 (patch)
tree08433a2e846051726d577cbf67e3fb932e446bc5 /examples2d
parent929aa6b9259b95d48cf6a84df40486132b21f088 (diff)
downloadrapier-0a9153e273dc0bdd4ba6443bd7f4dcfc671faac3.tar.gz
rapier-0a9153e273dc0bdd4ba6443bd7f4dcfc671faac3.tar.bz2
rapier-0a9153e273dc0bdd4ba6443bd7f4dcfc671faac3.zip
chore: clippy fixes
Diffstat (limited to 'examples2d')
-rw-r--r--examples2d/s2d_arch.rs2
-rw-r--r--examples2d/s2d_ball_and_chain.rs5
-rw-r--r--examples2d/s2d_bridge.rs2
-rw-r--r--examples2d/s2d_card_house.rs1
-rw-r--r--examples2d/s2d_confined.rs4
-rw-r--r--examples2d/s2d_far_pyramid.rs1
-rw-r--r--examples2d/s2d_high_mass_ratio_3.rs2
-rw-r--r--examples2d/s2d_joint_grid.rs7
-rw-r--r--examples2d/s2d_pyramid.rs2
9 files changed, 8 insertions, 18 deletions
diff --git a/examples2d/s2d_arch.rs b/examples2d/s2d_arch.rs
index ea92e66..5b935e9 100644
--- a/examples2d/s2d_arch.rs
+++ b/examples2d/s2d_arch.rs
@@ -10,6 +10,7 @@ pub fn init_world(testbed: &mut Testbed) {
let impulse_joints = ImpulseJointSet::new();
let multibody_joints = MultibodyJointSet::new();
+ #[allow(clippy::excessive_precision)]
let mut ps1 = [
Point::new(16.0, 0.0),
Point::new(14.93803712795643, 5.133601056842984),
@@ -22,6 +23,7 @@ pub fn init_world(testbed: &mut Testbed) {
Point::new(2.405937953536585, 39.09554102558315),
];
+ #[allow(clippy::excessive_precision)]
let mut ps2 = [
Point::new(24.0, 0.0),
Point::new(22.33619528222415, 6.02299846205841),
diff --git a/examples2d/s2d_ball_and_chain.rs b/examples2d/s2d_ball_and_chain.rs
index cbc1a1f..29e0d87 100644
--- a/examples2d/s2d_ball_and_chain.rs
+++ b/examples2d/s2d_ball_and_chain.rs
@@ -24,7 +24,7 @@ pub fn init_world(testbed: &mut Testbed) {
let friction = 0.6;
let capsule = ColliderBuilder::capsule_x(hx, 0.125)
.friction(friction)
- .density(20.0);
+ .density(density);
let mut prev = ground;
for i in 0..count {
@@ -55,7 +55,7 @@ pub fn init_world(testbed: &mut Testbed) {
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::ball(radius)
.friction(friction)
- .density(20.0);
+ .density(density);
colliders.insert_with_parent(collider, handle, &mut bodies);
let pivot = point![(2.0 * count as f32) * hx, count as f32 * hx];
@@ -64,7 +64,6 @@ pub fn init_world(testbed: &mut Testbed) {
.local_anchor2(bodies[handle].position().inverse_transform_point(&pivot))
.contacts_enabled(false);
impulse_joints.insert(prev, handle, joint, true);
- prev = handle;
/*
* Set up the testbed.
diff --git a/examples2d/s2d_bridge.rs b/examples2d/s2d_bridge.rs
index 712997e..ab9c96f 100644
--- a/examples2d/s2d_bridge.rs
+++ b/examples2d/s2d_bridge.rs
@@ -29,7 +29,7 @@ pub fn init_world(testbed: &mut Testbed) {
.angular_damping(0.1)
.translation(vector![x_base + 0.5 + 1.0 * i as f32, 20.0]);
let handle = bodies.insert(rigid_body);
- let collider = ColliderBuilder::cuboid(0.5, 0.125).density(20.0);
+ let collider = ColliderBuilder::cuboid(0.5, 0.125).density(density);
colliders.insert_with_parent(collider, handle, &mut bodies);
let pivot = point![x_base + 1.0 * i as f32, 20.0];
diff --git a/examples2d/s2d_card_house.rs b/examples2d/s2d_card_house.rs
index 0862062..5e2c5dc 100644
--- a/examples2d/s2d_card_house.rs
+++ b/examples2d/s2d_card_house.rs
@@ -10,7 +10,6 @@ pub fn init_world(testbed: &mut Testbed) {
let impulse_joints = ImpulseJointSet::new();
let multibody_joints = MultibodyJointSet::new();
- let extent = 1.0;
let friction = 0.7;
/*
diff --git a/examples2d/s2d_confined.rs b/examples2d/s2d_confined.rs
index 8b75a3d..ee54408 100644
--- a/examples2d/s2d_confined.rs
+++ b/examples2d/s2d_confined.rs
@@ -38,13 +38,13 @@ pub fn init_world(testbed: &mut Testbed) {
/*
* Create the spheres
*/
- let mut row = 0;
+ let mut row;
let mut count = 0;
let mut column = 0;
while count < max_count {
row = 0;
- for i in 0..grid_count {
+ for _ in 0..grid_count {
let x = -8.75 + column as f32 * 18.0 / (grid_count as f32);
let y = 1.5 + row as f32 * 18.0 / (grid_count as f32);
let body = RigidBodyBuilder::dynamic()
diff --git a/examples2d/s2d_far_pyramid.rs b/examples2d/s2d_far_pyramid.rs
index f5e34c0..7948731 100644
--- a/examples2d/s2d_far_pyramid.rs
+++ b/examples2d/s2d_far_pyramid.rs
@@ -11,7 +11,6 @@ pub fn init_world(testbed: &mut Testbed) {
let multibody_joints = MultibodyJointSet::new();
let origin = vector![100_000.0, -80_000.0];
- let extent = 1.0;
let friction = 0.6;
/*
diff --git a/examples2d/s2d_high_mass_ratio_3.rs b/examples2d/s2d_high_mass_ratio_3.rs
index f8dd3ee..b1f6340 100644
--- a/examples2d/s2d_high_mass_ratio_3.rs
+++ b/examples2d/s2d_high_mass_ratio_3.rs
@@ -16,8 +16,6 @@ pub fn init_world(testbed: &mut Testbed) {
/*
* Ground
*/
- let ground_width = 66.0 * extent;
-
let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -2.0]);
let ground_handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::cuboid(40.0, 2.0).friction(friction);
diff --git a/examples2d/s2d_joint_grid.rs b/examples2d/s2d_joint_grid.rs
index 97cea07..0033c70 100644
--- a/examples2d/s2d_joint_grid.rs
+++ b/examples2d/s2d_joint_grid.rs
@@ -11,12 +11,7 @@ pub fn init_world(testbed: &mut Testbed) {
let multibody_joints = MultibodyJointSet::new();
/*
- * Ground
- */
- let ground = bodies.insert(RigidBodyBuilder::fixed());
-
- /*
- * Create the bridge.
+ * Create the joint grid.
*/
let rad = 0.4;
let numi = 100;
diff --git a/examples2d/s2d_pyramid.rs b/examples2d/s2d_pyramid.rs
index 45e6310..c35fe63 100644
--- a/examples2d/s2d_pyramid.rs
+++ b/examples2d/s2d_pyramid.rs
@@ -10,8 +10,6 @@ pub fn init_world(testbed: &mut Testbed) {
let impulse_joints = ImpulseJointSet::new();
let multibody_joints = MultibodyJointSet::new();
- let extent = 1.0;
-
/*
* Ground
*/