aboutsummaryrefslogtreecommitdiff
path: root/src/pipeline
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2020-12-17 13:23:00 +0100
committerCrozet Sébastien <developer@crozet.re>2020-12-29 11:31:59 +0100
commit29717c2887b2db39faf9c25053730b661dc5da2b (patch)
treed7ec5abf85af4b3519ead56891dda23e02c08323 /src/pipeline
parente231bacec608fa5efd24f7a876572927dbd6c9c4 (diff)
downloadrapier-29717c2887b2db39faf9c25053730b661dc5da2b.tar.gz
rapier-29717c2887b2db39faf9c25053730b661dc5da2b.tar.bz2
rapier-29717c2887b2db39faf9c25053730b661dc5da2b.zip
Externalize the proximity code (renamed intersection).
Diffstat (limited to 'src/pipeline')
-rw-r--r--src/pipeline/collision_pipeline.rs2
-rw-r--r--src/pipeline/event_handler.rs20
-rw-r--r--src/pipeline/physics_pipeline.rs2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/pipeline/collision_pipeline.rs b/src/pipeline/collision_pipeline.rs
index 188be27..e80b9e8 100644
--- a/src/pipeline/collision_pipeline.rs
+++ b/src/pipeline/collision_pipeline.rs
@@ -64,7 +64,7 @@ impl CollisionPipeline {
contact_pair_filter,
events,
);
- narrow_phase.compute_proximities(
+ narrow_phase.compute_intersections(
prediction_distance,
bodies,
colliders,
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) {
diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs
index dc4b69f..ccc60e0 100644
--- a/src/pipeline/physics_pipeline.rs
+++ b/src/pipeline/physics_pipeline.rs
@@ -118,7 +118,7 @@ impl PhysicsPipeline {
contact_pair_filter,
events,
);
- narrow_phase.compute_proximities(
+ narrow_phase.compute_intersections(
integration_parameters.prediction_distance,
bodies,
colliders,