From 00706e8b360e132cb88a7b393dcedadf35403379 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 23 Feb 2021 11:24:54 +0100 Subject: Introduce the PhysicsHook trait used for both contact filtering and contact modification. --- examples3d/fountain3.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'examples3d') diff --git a/examples3d/fountain3.rs b/examples3d/fountain3.rs index 5acc2e8..caaa21b 100644 --- a/examples3d/fountain3.rs +++ b/examples3d/fountain3.rs @@ -23,16 +23,14 @@ pub fn init_world(testbed: &mut Testbed) { let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).build(); colliders.insert(collider, handle, &mut bodies); - let mut k = 0; // Callback that will be executed on the main loop to handle proximities. - testbed.add_callback(move |mut window, mut graphics, physics, _, _| { - k += 1; + testbed.add_callback(move |mut window, mut graphics, physics, _, run_state| { let rigid_body = RigidBodyBuilder::new_dynamic() .translation(0.0, 10.0, 0.0) .build(); let handle = physics.bodies.insert(rigid_body); - let collider = match k % 3 { + let collider = match run_state.timestep_id % 3 { 0 => ColliderBuilder::round_cylinder(rad, rad, rad / 10.0).build(), 1 => ColliderBuilder::cone(rad, rad).build(), _ => ColliderBuilder::cuboid(rad, rad, rad).build(), -- cgit