diff options
Diffstat (limited to 'examples2d/sensor2.rs')
| -rw-r--r-- | examples2d/sensor2.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/examples2d/sensor2.rs b/examples2d/sensor2.rs index 9ef5a6b..edd8933 100644 --- a/examples2d/sensor2.rs +++ b/examples2d/sensor2.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]) - .build(); + let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height]); let ground_handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(ground_size, ground_height).build(); + let collider = ColliderBuilder::cuboid(ground_size, ground_height); colliders.insert_with_parent(collider, ground_handle, &mut bodies); /* @@ -37,11 +35,9 @@ pub fn init_world(testbed: &mut Testbed) { let y = 3.0; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() - .translation(vector![x, y]) - .build(); + let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); - let collider = ColliderBuilder::cuboid(rad, rad).build(); + let collider = ColliderBuilder::cuboid(rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); testbed.set_initial_body_color(handle, [0.5, 0.5, 1.0]); @@ -52,14 +48,12 @@ pub fn init_world(testbed: &mut Testbed) { */ // Rigid body so that the sensor can move. - let sensor = RigidBodyBuilder::new_dynamic() - .translation(vector![0.0, 10.0]) - .build(); + let sensor = RigidBodyBuilder::new_dynamic().translation(vector![0.0, 10.0]); let sensor_handle = bodies.insert(sensor); // Solid cube attached to the sensor which // other colliders can touch. - let collider = ColliderBuilder::cuboid(rad, rad).build(); + let collider = ColliderBuilder::cuboid(rad, rad); colliders.insert_with_parent(collider, sensor_handle, &mut bodies); // We create a collider desc without density because we don't @@ -67,8 +61,7 @@ pub fn init_world(testbed: &mut Testbed) { let sensor_collider = ColliderBuilder::ball(rad * 5.0) .density(0.0) .sensor(true) - .active_events(ActiveEvents::INTERSECTION_EVENTS) - .build(); + .active_events(ActiveEvents::INTERSECTION_EVENTS); colliders.insert_with_parent(sensor_collider, sensor_handle, &mut bodies); testbed.set_initial_body_color(sensor_handle, [0.5, 1.0, 1.0]); |
