diff --git a/src/body.rs b/src/body.rs index 89101dfb..4c908067 100644 --- a/src/body.rs +++ b/src/body.rs @@ -515,11 +515,14 @@ pub struct RelativeCollision { } impl RelativeCollision { + pub fn model<'a>(&self,models:&'a Vec)->Option<&'a ModelPhysics>{ + models.get(self.model as usize) + } pub fn mesh(&self,models:&Vec) -> TreyMesh { - return models.get(self.model as usize).unwrap().face_mesh(self.face).clone() + return self.model(models).unwrap().face_mesh(self.face).clone() } pub fn normal(&self,models:&Vec) -> glam::Vec3 { - return models.get(self.model as usize).unwrap().face_normal(self.face) + return self.model(models).unwrap().face_normal(self.face) } }