diff options
| author | Crozet Sébastien <developer@crozet.re> | 2021-03-31 14:07:32 +0200 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2021-03-31 14:07:32 +0200 |
| commit | 365cce73f5586981afe741fdfd75fb7545472bab (patch) | |
| tree | b2590a7fc41d0b73b762cb0a606224021c68aea5 /src/geometry | |
| parent | 3412e9ddbf1e23a39d7de2efdc8449244ee5f92a (diff) | |
| download | rapier-365cce73f5586981afe741fdfd75fb7545472bab.tar.gz rapier-365cce73f5586981afe741fdfd75fb7545472bab.tar.bz2 rapier-365cce73f5586981afe741fdfd75fb7545472bab.zip | |
Make the collider shape mutable.
Diffstat (limited to 'src/geometry')
| -rw-r--r-- | src/geometry/collider.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index 11fe5ee..529d2f5 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -228,6 +228,15 @@ impl Collider { &*self.shape.0 } + /// A mutable reference to the geometric shape of this collider. + /// + /// If that shape is shared by multiple colliders, it will be + /// cloned first so that `self` contains a unique copy of that + /// shape that you can modify. + pub fn shape_mut(&mut self) -> &mut dyn Shape { + self.shape.make_mut() + } + /// Sets the shape of this collider. pub fn set_shape(&mut self, shape: SharedShape) { self.changes.insert(ColliderChanges::SHAPE); |
