From 24787fede51ac63933cbff0191ae52adee36fb1a Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 7 Jan 2025 20:19:44 -0800 Subject: [PATCH] improve get_model_transform readability --- strafe-client/src/physics.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/strafe-client/src/physics.rs b/strafe-client/src/physics.rs index 51fbf94..1fb2571 100644 --- a/strafe-client/src/physics.rs +++ b/strafe-client/src/physics.rs @@ -235,11 +235,11 @@ impl PhysicsModels{ } fn get_model_transform(&self,model_id:ModelId)->Option<&PhysicsMeshTransform>{ //ModelId can possibly be a decoration - self.contact_models.get(&ContactModelId::new(model_id.get())).map_or_else( - ||self.intersect_models.get(&IntersectModelId::new(model_id.get())) + match self.contact_models.get(&ContactModelId::new(model_id.get())){ + Some(model)=>Some(&model.transform), + None=>self.intersect_models.get(&IntersectModelId::new(model_id.get())) .map(|model|&model.transform), - |model|Some(&model.transform) - ) + } } fn contact_model(&self,model_id:ContactModelId)->&ContactModel{ &self.contact_models[&model_id]