aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/geometry/collider.rs9
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);