From 1be67e5f0ae1910fdbc2c6016020118f3fd3ee68 Mon Sep 17 00:00:00 2001 From: whatf0xx Date: Sun, 11 Feb 2024 16:22:52 +0100 Subject: [PATCH] add a Debug impl for SharedShape --- src/shape/shared_shape.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/shape/shared_shape.rs b/src/shape/shared_shape.rs index 5935029f..5d77ad20 100644 --- a/src/shape/shared_shape.rs +++ b/src/shape/shared_shape.rs @@ -5,7 +5,7 @@ use crate::shape::ConvexPolygon; use crate::shape::DeserializableTypedShape; use crate::shape::{ Ball, Capsule, Compound, Cuboid, HalfSpace, HeightField, Polyline, RoundShape, Segment, Shape, - TriMesh, TriMeshFlags, Triangle, + TriMesh, TriMeshFlags, Triangle, ShapeType }; #[cfg(feature = "dim3")] use crate::shape::{Cone, ConvexPolyhedron, Cylinder}; @@ -13,6 +13,7 @@ use crate::transformation::vhacd::{VHACDParameters, VHACD}; use na::Unit; use std::ops::Deref; use std::sync::Arc; +use std::fmt; /// The shape of a collider. #[derive(Clone)] @@ -31,6 +32,13 @@ impl AsRef for SharedShape { } } +impl fmt::Debug for SharedShape { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let shape_type: ShapeType = (*self.0).shape_type(); + write!(f, "SharedShape ( Arc<{:?}> )", shape_type) + } +} + impl SharedShape { /// Wraps the given shape as a shared shape. pub fn new(shape: impl Shape) -> Self {