aboutsummaryrefslogtreecommitdiff
path: root/src/pipeline/event_handler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipeline/event_handler.rs')
-rw-r--r--src/pipeline/event_handler.rs20
1 files changed, 10 insertions, 10 deletions
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<ProximityEvent>,
+ intersection_event_sender: Sender<IntersectionEvent>,
contact_event_sender: Sender<ContactEvent>,
}
impl ChannelEventCollector {
/// Initialize a new physics event handler from crossbeam channel senders.
pub fn new(
- proximity_event_sender: Sender<ProximityEvent>,
+ intersection_event_sender: Sender<IntersectionEvent>,
contact_event_sender: Sender<ContactEvent>,
) -> 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) {