From 29717c2887b2db39faf9c25053730b661dc5da2b Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Thu, 17 Dec 2020 13:23:00 +0100 Subject: Externalize the proximity code (renamed intersection). --- src/pipeline/event_handler.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/pipeline/event_handler.rs') diff --git a/src/pipeline/event_handler.rs b/src/pipeline/event_handler.rs index 67e4a78..9d7b17a 100644 --- a/src/pipeline/event_handler.rs +++ b/src/pipeline/event_handler.rs @@ -1,14 +1,14 @@ -use crate::geometry::{ContactEvent, ProximityEvent}; +use crate::geometry::{ContactEvent, IntersectionEvent}; use crossbeam::channel::Sender; /// Trait implemented by structures responsible for handling events generated by the physics engine. /// /// Implementors of this trait will typically collect these events for future processing. pub trait EventHandler: Send + Sync { - /// Handle a proximity event. + /// Handle an intersection event. /// - /// A proximity event is emitted when the state of proximity between two colliders changes. - fn handle_proximity_event(&self, event: ProximityEvent); + /// A intersection event is emitted when the state of intersection between two colliders changes. + fn handle_intersection_event(&self, event: IntersectionEvent); /// Handle a contact event. /// /// A contact event is emitted when two collider start or stop touching, independently from the @@ -17,32 +17,32 @@ pub trait EventHandler: Send + Sync { } impl EventHandler for () { - fn handle_proximity_event(&self, _event: ProximityEvent) {} + fn handle_intersection_event(&self, _event: IntersectionEvent) {} fn handle_contact_event(&self, _event: ContactEvent) {} } /// A physics event handler that collects events into a crossbeam channel. pub struct ChannelEventCollector { - proximity_event_sender: Sender, + intersection_event_sender: Sender, contact_event_sender: Sender, } impl ChannelEventCollector { /// Initialize a new physics event handler from crossbeam channel senders. pub fn new( - proximity_event_sender: Sender, + intersection_event_sender: Sender, contact_event_sender: Sender, ) -> Self { Self { - proximity_event_sender, + intersection_event_sender, contact_event_sender, } } } impl EventHandler for ChannelEventCollector { - fn handle_proximity_event(&self, event: ProximityEvent) { - let _ = self.proximity_event_sender.send(event); + fn handle_intersection_event(&self, event: IntersectionEvent) { + let _ = self.intersection_event_sender.send(event); } fn handle_contact_event(&self, event: ContactEvent) { -- cgit