diff options
| author | Crozet Sébastien <developer@crozet.re> | 2020-12-17 13:23:00 +0100 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2020-12-29 11:31:59 +0100 |
| commit | 29717c2887b2db39faf9c25053730b661dc5da2b (patch) | |
| tree | d7ec5abf85af4b3519ead56891dda23e02c08323 /examples3d | |
| parent | e231bacec608fa5efd24f7a876572927dbd6c9c4 (diff) | |
| download | rapier-29717c2887b2db39faf9c25053730b661dc5da2b.tar.gz rapier-29717c2887b2db39faf9c25053730b661dc5da2b.tar.bz2 rapier-29717c2887b2db39faf9c25053730b661dc5da2b.zip | |
Externalize the proximity code (renamed intersection).
Diffstat (limited to 'examples3d')
| -rw-r--r-- | examples3d/sensor3.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/examples3d/sensor3.rs b/examples3d/sensor3.rs index 7b218fe..234eaf3 100644 --- a/examples3d/sensor3.rs +++ b/examples3d/sensor3.rs @@ -1,6 +1,6 @@ use na::Point3; use rapier3d::dynamics::{JointSet, RigidBodyBuilder, RigidBodySet}; -use rapier3d::geometry::{ColliderBuilder, ColliderSet, Proximity}; +use rapier3d::geometry::{ColliderBuilder, ColliderSet}; use rapier_testbed3d::Testbed; pub fn init_world(testbed: &mut Testbed) { @@ -74,10 +74,11 @@ pub fn init_world(testbed: &mut Testbed) { // Callback that will be executed on the main loop to handle proximities. testbed.add_callback(move |_, physics, events, graphics, _| { - 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), - Proximity::Disjoint => Point3::new(0.5, 0.5, 1.0), + while let Ok(prox) = events.intersection_events.try_recv() { + let color = if prox.intersecting { + Point3::new(1.0, 1.0, 0.0) + } else { + Point3::new(0.5, 0.5, 1.0) }; let parent_handle1 = physics.colliders.get(prox.collider1).unwrap().parent(); |
