Skip to main content

collider_mesh/
mesh.rs

1use collider_shape::{Shape, ShapeType};
2
3/// A 3D mesh shape.
4pub struct Mesh {
5    /// The path to the mesh file.
6    pub path: String,
7}
8
9impl Mesh {
10    /// Creates a new Mesh from the given file path.
11    pub fn new(path: String) -> Self {
12        Mesh { path }
13    }
14}
15
16impl Shape for Mesh {
17    fn is_convex(&self) -> bool {
18        false
19    }
20
21    fn clone_box(&self) -> Box<dyn Shape + Send + Sync> {
22        Box::new(Mesh {
23            path: self.path.clone(),
24        })
25    }
26
27    fn get_shape_type(&self) -> ShapeType {
28        ShapeType::Mesh
29    }
30
31    fn get_mesh_path(&self) -> Option<String> {
32        Some(self.path.clone())
33    }
34}