diff options
| author | Waridley <Waridley64@gmail.com> | 2021-07-10 12:18:21 -0500 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2021-07-11 18:22:39 +0200 |
| commit | 9233a855f0fd13e61c475b32117838af95fb4c93 (patch) | |
| tree | 06808125abc8628568b23d3077721556fb80fc5d /src/geometry | |
| parent | 3b0d25646407e9b1d7e39dee1005d9a24e09ab66 (diff) | |
| download | rapier-9233a855f0fd13e61c475b32117838af95fb4c93.tar.gz rapier-9233a855f0fd13e61c475b32117838af95fb4c93.tar.bz2 rapier-9233a855f0fd13e61c475b32117838af95fb4c93.zip | |
impl more traits for components
Diffstat (limited to 'src/geometry')
| -rw-r--r-- | src/geometry/collider_components.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/geometry/collider_components.rs b/src/geometry/collider_components.rs index 111f527..7d621f3 100644 --- a/src/geometry/collider_components.rs +++ b/src/geometry/collider_components.rs @@ -3,7 +3,7 @@ use crate::geometry::{InteractionGroups, SAPProxyIndex, Shape, SharedShape}; use crate::math::{Isometry, Real}; use crate::parry::partitioning::IndexedData; use crate::pipeline::{ActiveEvents, ActiveHooks}; -use std::ops::Deref; +use std::ops::{Deref, DerefMut}; /// The unique identifier of a collider added to a collider set. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] @@ -97,7 +97,7 @@ impl ColliderType { } } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] /// Data associated to a collider that takes part to a broad-phase algorithm. pub struct ColliderBroadPhaseData { @@ -115,7 +115,7 @@ impl Default for ColliderBroadPhaseData { /// The shape of a collider. pub type ColliderShape = SharedShape; -#[derive(Clone)] +#[derive(Clone, PartialEq)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] /// The mass-properties of a collider. pub enum ColliderMassProps { @@ -155,7 +155,7 @@ impl ColliderMassProps { } } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] /// Information about the rigid-body this collider is attached to. pub struct ColliderParent { @@ -165,7 +165,7 @@ pub struct ColliderParent { pub pos_wrt_parent: Isometry<Real>, } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] /// The position of a collider. pub struct ColliderPosition(pub Isometry<Real>); @@ -177,6 +177,12 @@ impl AsRef<Isometry<Real>> for ColliderPosition { } } +impl AsMut<Isometry<Real>> for ColliderPosition { + fn as_mut(&mut self) -> &mut Isometry<Real> { + &mut self.0 + } +} + impl Deref for ColliderPosition { type Target = Isometry<Real>; #[inline] @@ -185,6 +191,12 @@ impl Deref for ColliderPosition { } } +impl DerefMut for ColliderPosition { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + impl Default for ColliderPosition { fn default() -> Self { Self::identity() @@ -208,7 +220,7 @@ where } } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] /// The constraints solver-related properties of this collider (friction, restitution, etc.) pub struct ColliderMaterial { @@ -329,7 +341,7 @@ impl Default for ActiveCollisionTypes { } } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] /// A set of flags for controlling collision/intersection filtering, modification, and events. pub struct ColliderFlags { |
