diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-02-20 12:55:00 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2022-03-20 21:49:16 +0100 |
| commit | fb20d72ee29de9311a81aec6eb9f02fd2aa35fc4 (patch) | |
| tree | 45827ac4c754c3670d1ddb2f91fc498515d6b3b8 /examples3d/debug_shape_modification3.rs | |
| parent | e740493b980dc9856864ead3206a4fa02aff965f (diff) | |
| download | rapier-fb20d72ee29de9311a81aec6eb9f02fd2aa35fc4.tar.gz rapier-fb20d72ee29de9311a81aec6eb9f02fd2aa35fc4.tar.bz2 rapier-fb20d72ee29de9311a81aec6eb9f02fd2aa35fc4.zip | |
Joint API and joint motors improvements
Diffstat (limited to 'examples3d/debug_shape_modification3.rs')
| -rw-r--r-- | examples3d/debug_shape_modification3.rs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/examples3d/debug_shape_modification3.rs b/examples3d/debug_shape_modification3.rs index eb2966e..5557131 100644 --- a/examples3d/debug_shape_modification3.rs +++ b/examples3d/debug_shape_modification3.rs @@ -16,14 +16,12 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 20.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static() - .translation(vector![0.0, -ground_height, 0.0]) - .build(); + let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size) .friction(0.15) // .restitution(0.5) - .build(); + ; colliders.insert_with_parent(collider, ground_handle, &mut bodies); /* @@ -32,10 +30,9 @@ pub fn init_world(testbed: &mut Testbed) { let ball_rad = 0.1; let rb = RigidBodyBuilder::new_dynamic() .translation(vector![0.0, 0.2, 0.0]) - .linvel(vector![10.0, 0.0, 0.0]) - .build(); + .linvel(vector![10.0, 0.0, 0.0]); let ball_handle = bodies.insert(rb); - let collider = ColliderBuilder::ball(ball_rad).density(100.0).build(); + let collider = ColliderBuilder::ball(ball_rad).density(100.0); let ball_coll_handle = colliders.insert_with_parent(collider, ball_handle, &mut bodies); let mut linvel = Vector::zeros(); @@ -90,19 +87,17 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shiftz - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() - .translation(vector![x, y, z]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = match j % 5 { - 0 => ColliderBuilder::cuboid(rad, rad, rad).build(), - 1 => ColliderBuilder::ball(rad).build(), + 0 => ColliderBuilder::cuboid(rad, rad, rad), + 1 => ColliderBuilder::ball(rad), // Rounded cylinders are much more efficient that cylinder, even if the // rounding margin is small. - 2 => ColliderBuilder::round_cylinder(rad, rad, rad / 10.0).build(), - 3 => ColliderBuilder::cone(rad, rad).build(), - _ => ColliderBuilder::capsule_y(rad, rad).build(), + 2 => ColliderBuilder::round_cylinder(rad, rad, rad / 10.0), + 3 => ColliderBuilder::cone(rad, rad), + _ => ColliderBuilder::capsule_y(rad, rad), }; colliders.insert_with_parent(collider, handle, &mut bodies); |
