From ed96572a24b1c9e5f33a28d9a1b68f55bd466de8 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 3 Oct 2023 17:20:35 -0700 Subject: [PATCH] RelativeCollision.model helper --- src/body.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) } }