diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-03-19 17:52:56 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2022-03-20 21:49:16 +0100 |
| commit | 063c638ec5906747e3ca85ee0c5f112c7775f797 (patch) | |
| tree | 498090f01c8cf8d69a35d03e123a1dfe006c54bf /examples2d/sensor2.rs | |
| parent | a9e3441ecd64d50b478ab5370fabe187ec9a5c39 (diff) | |
| download | rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.tar.gz rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.tar.bz2 rapier-063c638ec5906747e3ca85ee0c5f112c7775f797.zip | |
Combine contact events and intersection events into a single event type and flags
Diffstat (limited to 'examples2d/sensor2.rs')
| -rw-r--r-- | examples2d/sensor2.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples2d/sensor2.rs b/examples2d/sensor2.rs index e5a95df..6415f5d 100644 --- a/examples2d/sensor2.rs +++ b/examples2d/sensor2.rs @@ -68,15 +68,15 @@ pub fn init_world(testbed: &mut Testbed) { // Callback that will be executed on the main loop to handle proximities. testbed.add_callback(move |mut graphics, physics, events, _| { - while let Ok(prox) = events.intersection_events.try_recv() { - let color = if prox.intersecting { + while let Ok(prox) = events.events.try_recv() { + let color = if prox.started() { [1.0, 1.0, 0.0] } else { [0.5, 0.5, 1.0] }; - let parent_handle1 = physics.colliders[prox.collider1].parent().unwrap(); - let parent_handle2 = physics.colliders[prox.collider2].parent().unwrap(); + let parent_handle1 = physics.colliders[prox.collider1()].parent().unwrap(); + let parent_handle2 = physics.colliders[prox.collider2()].parent().unwrap(); if let Some(graphics) = &mut graphics { if parent_handle1 != ground_handle && parent_handle1 != sensor_handle { |
