diff options
| author | Sébastien Crozet <developer@crozet.re> | 2020-08-25 22:10:25 +0200 |
|---|---|---|
| committer | Sébastien Crozet <developer@crozet.re> | 2020-08-25 22:10:25 +0200 |
| commit | 754a48b7ff6d8c58b1ee08651e60112900b60455 (patch) | |
| tree | 7d777a6c003f1f5d8f8d24f533f35a95a88957fe /src/geometry/proximity.rs | |
| download | rapier-0.1.0.tar.gz rapier-0.1.0.tar.bz2 rapier-0.1.0.zip | |
First public release of Rapier.v0.1.0
Diffstat (limited to 'src/geometry/proximity.rs')
| -rw-r--r-- | src/geometry/proximity.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/geometry/proximity.rs b/src/geometry/proximity.rs new file mode 100644 index 0000000..88e6e76 --- /dev/null +++ b/src/geometry/proximity.rs @@ -0,0 +1,31 @@ +use crate::geometry::proximity_detector::ProximityPhase; +use crate::geometry::{ColliderPair, Proximity}; +use std::any::Any; + +#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] +/// The description of the proximity of two colliders. +pub struct ProximityPair { + /// The pair of collider involved. + pub pair: ColliderPair, + /// The state of proximity between the two colliders. + pub proximity: Proximity, + #[cfg_attr(feature = "serde-serialize", serde(skip))] + pub(crate) detector: Option<ProximityPhase>, + #[cfg_attr(feature = "serde-serialize", serde(skip))] + pub(crate) detector_workspace: Option<Box<dyn Any + Send + Sync>>, +} + +impl ProximityPair { + pub(crate) fn new( + pair: ColliderPair, + detector: ProximityPhase, + detector_workspace: Option<Box<dyn Any + Send + Sync>>, + ) -> Self { + Self { + pair, + proximity: Proximity::Disjoint, + detector: Some(detector), + detector_workspace, + } + } +} |
