diff options
| author | rezural <rezural@protonmail.com> | 2020-12-31 15:23:25 +1100 |
|---|---|---|
| committer | rezural <rezural@protonmail.com> | 2020-12-31 15:23:25 +1100 |
| commit | 6f508e5d04e5652991f9feaad09231af84542ac1 (patch) | |
| tree | bce4330348a5fe78bdb5476be7e837129818e7d6 | |
| parent | 1ac2d03fea4f51164df0b662fe990c27aedaf0ab (diff) | |
| download | rapier-6f508e5d04e5652991f9feaad09231af84542ac1.tar.gz rapier-6f508e5d04e5652991f9feaad09231af84542ac1.tar.bz2 rapier-6f508e5d04e5652991f9feaad09231af84542ac1.zip | |
remove redundant time :f32 from harness callbacks. it can be access via run_state.time
| -rw-r--r-- | examples2d/add_remove2.rs | 2 | ||||
| -rw-r--r-- | examples2d/platform2.rs | 2 | ||||
| -rw-r--r-- | examples2d/sensor2.rs | 2 | ||||
| -rw-r--r-- | examples3d/debug_add_remove_collider3.rs | 2 | ||||
| -rw-r--r-- | examples3d/debug_dynamic_collider_add3.rs | 2 | ||||
| -rw-r--r-- | examples3d/debug_rollback3.rs | 2 | ||||
| -rw-r--r-- | examples3d/fountain3.rs | 2 | ||||
| -rw-r--r-- | examples3d/platform3.rs | 2 | ||||
| -rw-r--r-- | examples3d/sensor3.rs | 2 | ||||
| -rw-r--r-- | src_testbed/harness/mod.rs | 5 |
10 files changed, 11 insertions, 12 deletions
diff --git a/examples2d/add_remove2.rs b/examples2d/add_remove2.rs index a351a8f..614829b 100644 --- a/examples2d/add_remove2.rs +++ b/examples2d/add_remove2.rs @@ -10,7 +10,7 @@ pub fn init_world(testbed: &mut Testbed) { let rad = 0.5; // Callback that will be executed on the main loop to handle proximities. - testbed.harness_mut().add_callback(move |physics, _, _, _| { + testbed.harness_mut().add_callback(move |physics, _, _| { let rigid_body = RigidBodyBuilder::new_dynamic() .translation(0.0, 10.0) .build(); diff --git a/examples2d/platform2.rs b/examples2d/platform2.rs index 769161f..88f05f2 100644 --- a/examples2d/platform2.rs +++ b/examples2d/platform2.rs @@ -62,7 +62,7 @@ pub fn init_world(testbed: &mut Testbed) { */ testbed .harness_mut() - .add_callback(move |physics, _, run_state, _| { + .add_callback(move |physics, _, run_state| { let platform = physics.bodies.get_mut(platform_handle).unwrap(); let mut next_pos = *platform.position(); diff --git a/examples2d/sensor2.rs b/examples2d/sensor2.rs index 123f633..382581e 100644 --- a/examples2d/sensor2.rs +++ b/examples2d/sensor2.rs @@ -71,7 +71,7 @@ pub fn init_world(testbed: &mut Testbed) { // Callback that will be executed on the main loop to handle proximities. testbed .harness_mut() - .add_callback(move |physics, events, _, _| { + .add_callback(move |physics, events, _| { while let Ok(prox) = events.proximity_events.try_recv() { let color = match prox.new_status { Proximity::WithinMargin | Proximity::Intersecting => Point3::new(1.0, 1.0, 0.0), diff --git a/examples3d/debug_add_remove_collider3.rs b/examples3d/debug_add_remove_collider3.rs index 1c59fcf..437a27d 100644 --- a/examples3d/debug_add_remove_collider3.rs +++ b/examples3d/debug_add_remove_collider3.rs @@ -34,7 +34,7 @@ pub fn init_world(testbed: &mut Testbed) { let collider = ColliderBuilder::ball(ball_rad).density(100.0).build(); colliders.insert(collider, ball_handle, &mut bodies); - testbed.harness_mut().add_callback(move |physics, _, _, _| { + testbed.harness_mut().add_callback(move |physics, _, _| { // Remove then re-add the ground collider. let coll = physics .colliders diff --git a/examples3d/debug_dynamic_collider_add3.rs b/examples3d/debug_dynamic_collider_add3.rs index da33494..92ae209 100644 --- a/examples3d/debug_dynamic_collider_add3.rs +++ b/examples3d/debug_dynamic_collider_add3.rs @@ -45,7 +45,7 @@ pub fn init_world(testbed: &mut Testbed) { let mut extra_colliders = Vec::new(); let snapped_frame = 51; - testbed.harness_mut().add_callback(move |physics, _, _, _| { + testbed.harness_mut().add_callback(move |physics, _, _| { step += 1; // Add a bigger ball collider diff --git a/examples3d/debug_rollback3.rs b/examples3d/debug_rollback3.rs index c3eb684..aa0b0ff 100644 --- a/examples3d/debug_rollback3.rs +++ b/examples3d/debug_rollback3.rs @@ -44,7 +44,7 @@ pub fn init_world(testbed: &mut Testbed) { let mut step = 0; let snapped_frame = 51; - testbed.harness_mut().add_callback(move |physics, _, _, _| { + testbed.harness_mut().add_callback(move |physics, _, _| { step += 1; // Snap the ball velocity or restore it. diff --git a/examples3d/fountain3.rs b/examples3d/fountain3.rs index 5dcf2d8..0909a0c 100644 --- a/examples3d/fountain3.rs +++ b/examples3d/fountain3.rs @@ -26,7 +26,7 @@ pub fn init_world(testbed: &mut Testbed) { let mut k = 0; // Callback that will be executed on the main loop to handle proximities. - testbed.harness_mut().add_callback(move |physics, _, _, _| { + testbed.harness_mut().add_callback(move |physics, _, _| { k += 1; let rigid_body = RigidBodyBuilder::new_dynamic() .translation(0.0, 10.0, 0.0) diff --git a/examples3d/platform3.rs b/examples3d/platform3.rs index b71d307..944adae 100644 --- a/examples3d/platform3.rs +++ b/examples3d/platform3.rs @@ -67,7 +67,7 @@ pub fn init_world(testbed: &mut Testbed) { let mut count = 0; testbed .harness_mut() - .add_callback(move |physics, _, run_state, _| { + .add_callback(move |physics, _, run_state| { count += 1; if count % 100 > 50 { return; diff --git a/examples3d/sensor3.rs b/examples3d/sensor3.rs index e734258..db01265 100644 --- a/examples3d/sensor3.rs +++ b/examples3d/sensor3.rs @@ -75,7 +75,7 @@ pub fn init_world(testbed: &mut Testbed) { // Callback that will be executed on the main loop to handle proximities. testbed .harness_mut() - .add_callback(move |physics, events, _, _| { + .add_callback(move |physics, events, _| { while let Ok(prox) = events.proximity_events.try_recv() { let color = match prox.new_status { Proximity::WithinMargin | Proximity::Intersecting => Point3::new(1.0, 1.0, 0.0), diff --git a/src_testbed/harness/mod.rs b/src_testbed/harness/mod.rs index 45e52dc..638c4ed 100644 --- a/src_testbed/harness/mod.rs +++ b/src_testbed/harness/mod.rs @@ -48,7 +48,7 @@ pub struct Harness { pub state: RunState, } -type Callbacks = Vec<Box<dyn FnMut(&mut PhysicsState, &PhysicsEvents, &RunState, f32)>>; +type Callbacks = Vec<Box<dyn FnMut(&mut PhysicsState, &PhysicsEvents, &RunState)>>; #[allow(dead_code)] impl Harness { @@ -130,7 +130,7 @@ impl Harness { self.plugins.push(Box::new(plugin)); } - pub fn add_callback<F: FnMut(&mut PhysicsState, &PhysicsEvents, &RunState, f32) + 'static>( + pub fn add_callback<F: FnMut(&mut PhysicsState, &PhysicsEvents, &RunState) + 'static>( &mut self, callback: F, ) { @@ -185,7 +185,6 @@ impl Harness { &mut self.physics, &self.events, &self.state, - self.state.time, ) } |
