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 /benchmarks3d | |
| parent | e740493b980dc9856864ead3206a4fa02aff965f (diff) | |
| download | rapier-fb20d72ee29de9311a81aec6eb9f02fd2aa35fc4.tar.gz rapier-fb20d72ee29de9311a81aec6eb9f02fd2aa35fc4.tar.bz2 rapier-fb20d72ee29de9311a81aec6eb9f02fd2aa35fc4.zip | |
Joint API and joint motors improvements
Diffstat (limited to 'benchmarks3d')
| -rw-r--r-- | benchmarks3d/balls3.rs | 6 | ||||
| -rw-r--r-- | benchmarks3d/boxes3.rs | 12 | ||||
| -rw-r--r-- | benchmarks3d/capsules3.rs | 12 | ||||
| -rw-r--r-- | benchmarks3d/ccd3.rs | 11 | ||||
| -rw-r--r-- | benchmarks3d/compound3.rs | 28 | ||||
| -rw-r--r-- | benchmarks3d/convex_polyhedron3.rs | 14 | ||||
| -rw-r--r-- | benchmarks3d/heightfield3.rs | 12 | ||||
| -rw-r--r-- | benchmarks3d/joint_ball3.rs | 11 | ||||
| -rw-r--r-- | benchmarks3d/joint_fixed3.rs | 16 | ||||
| -rw-r--r-- | benchmarks3d/joint_prismatic3.rs | 18 | ||||
| -rw-r--r-- | benchmarks3d/joint_revolute3.rs | 22 | ||||
| -rw-r--r-- | benchmarks3d/keva3.rs | 34 | ||||
| -rw-r--r-- | benchmarks3d/pyramid3.rs | 12 | ||||
| -rw-r--r-- | benchmarks3d/stacks3.rs | 24 | ||||
| -rw-r--r-- | benchmarks3d/trimesh3.rs | 12 |
15 files changed, 97 insertions, 147 deletions
diff --git a/benchmarks3d/balls3.rs b/benchmarks3d/balls3.rs index b4d5102..4ccf594 100644 --- a/benchmarks3d/balls3.rs +++ b/benchmarks3d/balls3.rs @@ -36,11 +36,9 @@ pub fn init_world(testbed: &mut Testbed) { let density = 0.477; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new(status) - .translation(vector![x, y, z]) - .build(); + let rigid_body = RigidBodyBuilder::new(status).translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::ball(rad).density(density).build(); + let collider = ColliderBuilder::ball(rad).density(density); colliders.insert_with_parent(collider, handle, &mut bodies); } } diff --git a/benchmarks3d/boxes3.rs b/benchmarks3d/boxes3.rs index 0250619..e816a63 100644 --- a/benchmarks3d/boxes3.rs +++ b/benchmarks3d/boxes3.rs @@ -16,11 +16,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; 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 handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* @@ -44,11 +42,9 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - 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 = ColliderBuilder::cuboid(rad, rad, rad).build(); + let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); } } diff --git a/benchmarks3d/capsules3.rs b/benchmarks3d/capsules3.rs index 5b05f23..ec00e2d 100644 --- a/benchmarks3d/capsules3.rs +++ b/benchmarks3d/capsules3.rs @@ -16,11 +16,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; 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 handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* @@ -45,11 +43,9 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - 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 = ColliderBuilder::capsule_y(rad, rad).build(); + let collider = ColliderBuilder::capsule_y(rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); } } diff --git a/benchmarks3d/ccd3.rs b/benchmarks3d/ccd3.rs index d54ebc1..ed137a2 100644 --- a/benchmarks3d/ccd3.rs +++ b/benchmarks3d/ccd3.rs @@ -16,11 +16,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.1; 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 handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* @@ -50,8 +48,7 @@ pub fn init_world(testbed: &mut Testbed) { let rigid_body = RigidBodyBuilder::new_dynamic() .translation(vector![x, y, z]) .linvel(vector![0.0, -1000.0, 0.0]) - .ccd_enabled(true) - .build(); + .ccd_enabled(true); let handle = bodies.insert(rigid_body); let collider = match j % 5 { @@ -64,7 +61,7 @@ pub fn init_world(testbed: &mut Testbed) { _ => ColliderBuilder::capsule_y(rad, rad), }; - colliders.insert_with_parent(collider.build(), handle, &mut bodies); + colliders.insert_with_parent(collider, handle, &mut bodies); } } diff --git a/benchmarks3d/compound3.rs b/benchmarks3d/compound3.rs index 872923c..04e8c78 100644 --- a/benchmarks3d/compound3.rs +++ b/benchmarks3d/compound3.rs @@ -16,11 +16,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; 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 handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* @@ -44,17 +42,19 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift * 2.0 - 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 collider1 = ColliderBuilder::cuboid(rad * 10.0, rad, rad).build(); - let collider2 = ColliderBuilder::cuboid(rad, rad * 10.0, rad) - .translation(vector![rad * 10.0, rad * 10.0, 0.0]) - .build(); - let collider3 = ColliderBuilder::cuboid(rad, rad * 10.0, rad) - .translation(vector![-rad * 10.0, rad * 10.0, 0.0]) - .build(); + let collider1 = ColliderBuilder::cuboid(rad * 10.0, rad, rad); + let collider2 = ColliderBuilder::cuboid(rad, rad * 10.0, rad).translation(vector![ + rad * 10.0, + rad * 10.0, + 0.0 + ]); + let collider3 = ColliderBuilder::cuboid(rad, rad * 10.0, rad).translation(vector![ + -rad * 10.0, + rad * 10.0, + 0.0 + ]); colliders.insert_with_parent(collider1, handle, &mut bodies); colliders.insert_with_parent(collider2, handle, &mut bodies); colliders.insert_with_parent(collider3, handle, &mut bodies); diff --git a/benchmarks3d/convex_polyhedron3.rs b/benchmarks3d/convex_polyhedron3.rs index cb834ea..5d9f363 100644 --- a/benchmarks3d/convex_polyhedron3.rs +++ b/benchmarks3d/convex_polyhedron3.rs @@ -18,11 +18,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; 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 handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* @@ -57,13 +55,9 @@ pub fn init_world(testbed: &mut Testbed) { } // 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 = ColliderBuilder::round_convex_hull(&points, border_rad) - .unwrap() - .build(); + let collider = ColliderBuilder::round_convex_hull(&points, border_rad).unwrap(); colliders.insert_with_parent(collider, handle, &mut bodies); } } diff --git a/benchmarks3d/heightfield3.rs b/benchmarks3d/heightfield3.rs index b95f1ee..6bf6fc0 100644 --- a/benchmarks3d/heightfield3.rs +++ b/benchmarks3d/heightfield3.rs @@ -31,9 +31,9 @@ pub fn init_world(testbed: &mut Testbed) { } }); - let rigid_body = RigidBodyBuilder::new_static().build(); + let rigid_body = RigidBodyBuilder::new_static(); let handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::heightfield(heights, ground_size).build(); + let collider = ColliderBuilder::heightfield(heights, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* @@ -55,16 +55,14 @@ 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(vector![x, y, z]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); if j % 2 == 0 { - let collider = ColliderBuilder::cuboid(rad, rad, rad).build(); + let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); } else { - let collider = ColliderBuilder::ball(rad).build(); + let collider = ColliderBuilder::ball(rad); colliders.insert_with_parent(collider, handle, &mut bodies); } } diff --git a/benchmarks3d/joint_ball3.rs b/benchmarks3d/joint_ball3.rs index 64128ba..4b509af 100644 --- a/benchmarks3d/joint_ball3.rs +++ b/benchmarks3d/joint_ball3.rs @@ -27,17 +27,16 @@ pub fn init_world(testbed: &mut Testbed) { RigidBodyType::Dynamic }; - let rigid_body = RigidBodyBuilder::new(status) - .translation(vector![fk * shift, 0.0, fi * shift]) - .build(); + let rigid_body = + RigidBodyBuilder::new(status).translation(vector![fk * shift, 0.0, fi * shift]); let child_handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::ball(rad).build(); + let collider = ColliderBuilder::ball(rad); colliders.insert_with_parent(collider, child_handle, &mut bodies); // Vertical joint. if i > 0 { let parent_handle = *body_handles.last().unwrap(); - let joint = SphericalJoint::new().local_anchor2(point![0.0, 0.0, -shift]); + let joint = SphericalJointBuilder::new().local_anchor2(point![0.0, 0.0, -shift]); impulse_joints.insert(parent_handle, child_handle, joint); } @@ -45,7 +44,7 @@ pub fn init_world(testbed: &mut Testbed) { if k > 0 { let parent_index = body_handles.len() - num; let parent_handle = body_handles[parent_index]; - let joint = SphericalJoint::new().local_anchor2(point![-shift, 0.0, 0.0]); + let joint = SphericalJointBuilder::new().local_anchor2(point![-shift, 0.0, 0.0]); impulse_joints.insert(parent_handle, child_handle, joint); } diff --git a/benchmarks3d/joint_fixed3.rs b/benchmarks3d/joint_fixed3.rs index b3f4039..5fdba9c 100644 --- a/benchmarks3d/joint_fixed3.rs +++ b/benchmarks3d/joint_fixed3.rs @@ -40,17 +40,20 @@ pub fn init_world(testbed: &mut Testbed) { RigidBodyType::Dynamic }; - let rigid_body = RigidBodyBuilder::new(status) - .translation(vector![x + fk * shift, y, z + fi * shift]) - .build(); + let rigid_body = RigidBodyBuilder::new(status).translation(vector![ + x + fk * shift, + y, + z + fi * shift + ]); let child_handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::ball(rad).build(); + let collider = ColliderBuilder::ball(rad); colliders.insert_with_parent(collider, child_handle, &mut bodies); // Vertical joint. if i > 0 { let parent_handle = *body_handles.last().unwrap(); - let joint = FixedJoint::new().local_anchor2(point![0.0, 0.0, -shift]); + let joint = + FixedJointBuilder::new().local_anchor2(point![0.0, 0.0, -shift]); impulse_joints.insert(parent_handle, child_handle, joint); } @@ -58,7 +61,8 @@ pub fn init_world(testbed: &mut Testbed) { if k > 0 { let parent_index = body_handles.len() - num; let parent_handle = body_handles[parent_index]; - let joint = FixedJoint::new().local_anchor2(point![-shift, 0.0, 0.0]); + let joint = + FixedJointBuilder::new().local_anchor2(point![-shift, 0.0, 0.0]); impulse_joints.insert(parent_handle, child_handle, joint); } diff --git a/benchmarks3d/joint_prismatic3.rs b/benchmarks3d/joint_prismatic3.rs index 80839d7..faa5f93 100644 --- a/benchmarks3d/joint_prismatic3.rs +++ b/benchmarks3d/joint_prismatic3.rs @@ -23,23 +23,17 @@ pub fn init_world(testbed: &mut Testbed) { for j in 0..50 { let x = j as f32 * shift * 4.0; - let ground = RigidBodyBuilder::new_static() - .translation(vector![x, y, z]) - .build(); + let ground = RigidBodyBuilder::new_static().translation(vector![x, y, z]); let mut curr_parent = bodies.insert(ground); - let collider = ColliderBuilder::cuboid(rad, rad, rad).build(); + let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_parent, &mut bodies); for i in 0..num { let z = z + (i + 1) as f32 * shift; let density = 1.0; - let rigid_body = RigidBodyBuilder::new_dynamic() - .translation(vector![x, y, z]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); let curr_child = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(rad, rad, rad) - .density(density) - .build(); + let collider = ColliderBuilder::cuboid(rad, rad, rad).density(density); colliders.insert_with_parent(collider, curr_child, &mut bodies); let axis = if i % 2 == 0 { @@ -48,9 +42,9 @@ pub fn init_world(testbed: &mut Testbed) { UnitVector::new_normalize(vector![-1.0, 1.0, 0.0]) }; - let prism = PrismaticJoint::new(axis) + let prism = PrismaticJointBuilder::new(axis) .local_anchor2(point![0.0, 0.0, -shift]) - .limit_axis([-2.0, 0.0]); + .limits([-2.0, 0.0]); impulse_joints.insert(curr_parent, curr_child, prism); curr_parent = curr_child; diff --git a/benchmarks3d/joint_revolute3.rs b/benchmarks3d/joint_revolute3.rs index 8bdf0e9..aa1be50 100644 --- a/benchmarks3d/joint_revolute3.rs +++ b/benchmarks3d/joint_revolute3.rs @@ -20,11 +20,9 @@ pub fn init_world(testbed: &mut Testbed) { for j in 0..50 { let x = j as f32 * shift * 4.0; - let ground = RigidBodyBuilder::new_static() - .translation(vector![x, y, 0.0]) - .build(); + let ground = RigidBodyBuilder::new_static().translation(vector![x, y, 0.0]); let mut curr_parent = bodies.insert(ground); - let collider = ColliderBuilder::cuboid(rad, rad, rad).build(); + let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_parent, &mut bodies); for i in 0..num { @@ -40,13 +38,9 @@ pub fn init_world(testbed: &mut Testbed) { let mut handles = [curr_parent; 4]; for k in 0..4 { let density = 1.0; - let rigid_body = RigidBodyBuilder::new_dynamic() - .position(positions[k]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().position(positions[k]); handles[k] = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(rad, rad, rad) - .density(density) - .build(); + let collider = ColliderBuilder::cuboid(rad, rad, rad).density(density); colliders.insert_with_parent(collider, handles[k], &mut bodies); } @@ -55,10 +49,10 @@ pub fn init_world(testbed: &mut Testbed) { let z = Vector::z_axis(); let revs = [ - RevoluteJoint::new(z).local_anchor2(point![0.0, 0.0, -shift]), - RevoluteJoint::new(x).local_anchor2(point![-shift, 0.0, 0.0]), - RevoluteJoint::new(z).local_anchor2(point![0.0, 0.0, -shift]), - RevoluteJoint::new(x).local_anchor2(point![shift, 0.0, 0.0]), + RevoluteJointBuilder::new(z).local_anchor2(point![0.0, 0.0, -shift]), + RevoluteJointBuilder::new(x).local_anchor2(point![-shift, 0.0, 0.0]), + RevoluteJointBuilder::new(z).local_anchor2(point![0.0, 0.0, -shift]), + RevoluteJointBuilder::new(x).local_anchor2(point![shift, 0.0, 0.0]), ]; impulse_joints.insert(curr_parent, handles[0], revs[0]); diff --git a/benchmarks3d/keva3.rs b/benchmarks3d/keva3.rs index ad9e1ae..30e5246 100644 --- a/benchmarks3d/keva3.rs +++ b/benchmarks3d/keva3.rs @@ -38,15 +38,13 @@ pub fn build_block( }; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() - .translation(vector![ - x + dim.x + shift.x, - y + dim.y + shift.y, - z + dim.z + shift.z - ]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![ + x + dim.x + shift.x, + y + dim.y + shift.y, + z + dim.z + shift.z + ]); let handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(dim.x, dim.y, dim.z).build(); + let collider = ColliderBuilder::cuboid(dim.x, dim.y, dim.z); colliders.insert_with_parent(collider, handle, bodies); testbed.set_initial_body_color(handle, color0); @@ -61,15 +59,13 @@ pub fn build_block( for i in 0..(block_width / (dim.x as f32 * 2.0)) as usize { for j in 0..(block_width / (dim.z as f32 * 2.0)) as usize { // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() - .translation(vector![ - i as f32 * dim.x * 2.0 + dim.x + shift.x, - dim.y + shift.y + block_height, - j as f32 * dim.z * 2.0 + dim.z + shift.z - ]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![ + i as f32 * dim.x * 2.0 + dim.x + shift.x, + dim.y + shift.y + block_height, + j as f32 * dim.z * 2.0 + dim.z + shift.z + ]); let handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(dim.x, dim.y, dim.z).build(); + let collider = ColliderBuilder::cuboid(dim.x, dim.y, dim.z); colliders.insert_with_parent(collider, handle, bodies); testbed.set_initial_body_color(handle, color0); std::mem::swap(&mut color0, &mut color1); @@ -92,11 +88,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.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 handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* diff --git a/benchmarks3d/pyramid3.rs b/benchmarks3d/pyramid3.rs index b378da4..572db45 100644 --- a/benchmarks3d/pyramid3.rs +++ b/benchmarks3d/pyramid3.rs @@ -22,13 +22,11 @@ fn create_pyramid( - stack_height as f32 * half_extents.z; // 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 rigid_body_handle = bodies.insert(rigid_body); let collider = - ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z).build(); + ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); colliders.insert_with_parent(collider, rigid_body_handle, bodies); } } @@ -50,11 +48,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.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).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, ground_handle, &mut bodies); /* diff --git a/benchmarks3d/stacks3.rs b/benchmarks3d/stacks3.rs index 7fc9097..ff67917 100644 --- a/benchmarks3d/stacks3.rs +++ b/benchmarks3d/stacks3.rs @@ -23,10 +23,9 @@ fn create_tower_circle( * Translation::new(0.0, y, radius); // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().position(pos).build(); + let rigid_body = RigidBodyBuilder::new_dynamic().position(pos); let handle = bodies.insert(rigid_body); - let collider = - ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z).build(); + let collider = ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); colliders.insert_with_parent(collider, handle, bodies); } } @@ -50,12 +49,9 @@ fn create_wall( - stack_height as f32 * half_extents.z; // 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 = - ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z).build(); + let collider = ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); colliders.insert_with_parent(collider, handle, bodies); } } @@ -83,12 +79,10 @@ fn create_pyramid( - stack_height as f32 * half_extents.z; // 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 = - ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z).build(); + ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); colliders.insert_with_parent(collider, handle, bodies); } } @@ -110,11 +104,9 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.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 handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); /* diff --git a/benchmarks3d/trimesh3.rs b/benchmarks3d/trimesh3.rs index 1039a09..e9d73ee 100644 --- a/benchmarks3d/trimesh3.rs +++ b/benchmarks3d/trimesh3.rs @@ -36,9 +36,9 @@ pub fn init_world(testbed: &mut Testbed) { let heightfield = HeightField::new(heights, ground_size); let (vertices, indices) = heightfield.to_trimesh(); - let rigid_body = RigidBodyBuilder::new_static().build(); + let rigid_body = RigidBodyBuilder::new_static(); let handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::trimesh(vertices, indices).build(); + let collider = ColliderBuilder::trimesh(vertices, indices); colliders.insert_with_parent(collider, handle, &mut bodies); /* @@ -60,16 +60,14 @@ 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(vector![x, y, z]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); if j % 2 == 0 { - let collider = ColliderBuilder::cuboid(rad, rad, rad).build(); + let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); } else { - let collider = ColliderBuilder::ball(rad).build(); + let collider = ColliderBuilder::ball(rad); colliders.insert_with_parent(collider, handle, &mut bodies); } } |
