pub fn handle(&self) -> ShapeHandle<N> {
        match self {
            Shape::Ball { radius } => ShapeHandle::new(Ball::<N>::new(*radius)),
            Shape::Capsule {
                half_height,
                radius,
            } => ShapeHandle::new(Capsule::new(*half_height, *radius)),
            Shape::Compound { parts } => ShapeHandle::new(Compound::new(
                parts.iter().map(|part| (part.0, part.1.handle())).collect(),
            )),
            Shape::ConvexHull { points } => ShapeHandle::new(
                ConvexHull::try_from_points(&points)
                    .expect("Failed to generate Convex Hull from points."),
            ),
            Shape::Cuboid { half_extents } => ShapeHandle::new(Cuboid::new(*half_extents)),
            Shape::HeightField { heights, scale } => {
                ShapeHandle::new(HeightField::new(heights.clone(), *scale))
            }
            Shape::Plane { normal } => ShapeHandle::new(Plane::new(*normal)),
            Shape::Polyline { points, indices } => {
                ShapeHandle::new(Polyline::new(points.clone(), indices.clone()))
            }
            Shape::Segment { a, b } => ShapeHandle::new(Segment::new(*a, *b)),
            Shape::TriMesh { handle } => {
                let data = handle.points();
                ShapeHandle::new(TriMesh::new(data.0, data.1, data.2))
            }
            Shape::Triangle { a, b, c } => ShapeHandle::new(Triangle::new(*a, *b, *c)),
        }
    }
/// Converts a `Shape` and its values into its corresponding `ShapeHandle`
/// type. The `ShapeHandle` is used to define a `Collider` in the
/// `PhysicsWorld`.
Converts a `Shape` and its values into its corresponding `ShapeHandle`
type.
Converts a ` Shape ` and its values into its corresponding ` ShapeHandle ` type .
pub fn handle(&self) -> ShapeHandle<N> {
        match self {
            Shape::Ball { radius } => ShapeHandle::new(Ball::<N>::new(*radius)),
            Shape::Capsule {
                half_height,
                radius,
            } => ShapeHandle::new(Capsule::new(*half_height, *radius)),
            Shape::Compound { parts } => ShapeHandle::new(Compound::new(
                parts.iter().map(|part| (part.0, part.1.handle())).collect(),
            )),
            Shape::ConvexHull { points } => ShapeHandle::new(
                ConvexHull::try_from_points(&points)
                    .expect("Failed to generate Convex Hull from points."),
            ),
            Shape::Cuboid { half_extents } => ShapeHandle::new(Cuboid::new(*half_extents)),
            Shape::HeightField { heights, scale } => {
                ShapeHandle::new(HeightField::new(heights.clone(), *scale))
            }
            Shape::Plane { normal } => ShapeHandle::new(Plane::new(*normal)),
            Shape::Polyline { points, indices } => {
                ShapeHandle::new(Polyline::new(points.clone(), indices.clone()))
            }
            Shape::Segment { a, b } => ShapeHandle::new(Segment::new(*a, *b)),
            Shape::TriMesh { handle } => {
                let data = handle.points();
                ShapeHandle::new(TriMesh::new(data.0, data.1, data.2))
            }
            Shape::Triangle { a, b, c } => ShapeHandle::new(Triangle::new(*a, *b, *c)),
        }
    }
pub fn handle ( & self ) -> ShapeHandle < N > { match self { Shape :: Ball { radius } => ShapeHandle :: new ( Ball :: < N > :: new ( * radius ) ) , Shape :: Capsule { half_height , radius , } => ShapeHandle :: new ( Capsule :: new ( * half_height , * radius ) ) , Shape :: Compound { parts } => ShapeHandle :: new ( Compound :: new ( parts . iter ( ) . map ( | part | ( part . 0 , part . 1 . handle ( ) ) ) . collect ( ) , ) ) , Shape :: ConvexHull { points } => ShapeHandle :: new ( ConvexHull :: try_from_points ( & points ) . expect ( " " ) , ) , Shape :: Cuboid { half_extents } => ShapeHandle :: new ( Cuboid :: new ( * half_extents ) ) , Shape :: HeightField { heights , scale } => { ShapeHandle :: new ( HeightField :: new ( heights . clone ( ) , * scale ) ) } Shape :: Plane { normal } => ShapeHandle :: new ( Plane :: new ( * normal ) ) , Shape :: Polyline { points , indices } => { ShapeHandle :: new ( Polyline :: new ( points . clone ( ) , indices . clone ( ) ) ) } Shape :: Segment { a , b } => ShapeHandle :: new ( Segment :: new ( * a , * b ) ) , Shape :: TriMesh { handle } => { let data = handle . points ( ) ; ShapeHandle :: new ( TriMesh :: new ( data . 0 , data . 1 , data . 2 ) ) } Shape :: Triangle { a , b , c } => ShapeHandle :: new ( Triangle :: new ( * a , * b , * c ) ) , } }
Converts a `Shape` and its values into its corresponding `ShapeHandle`
type.
Converts a ` Shape ` and its values into its corresponding ` ShapeHandle ` type .
&self