improve get_model_transform readability

This commit is contained in:
Quaternions 2025-01-07 20:19:44 -08:00
parent 3797408bc8
commit 24787fede5

View File

@ -235,11 +235,11 @@ impl PhysicsModels{
} }
fn get_model_transform(&self,model_id:ModelId)->Option<&PhysicsMeshTransform>{ fn get_model_transform(&self,model_id:ModelId)->Option<&PhysicsMeshTransform>{
//ModelId can possibly be a decoration //ModelId can possibly be a decoration
self.contact_models.get(&ContactModelId::new(model_id.get())).map_or_else( match self.contact_models.get(&ContactModelId::new(model_id.get())){
||self.intersect_models.get(&IntersectModelId::new(model_id.get())) Some(model)=>Some(&model.transform),
None=>self.intersect_models.get(&IntersectModelId::new(model_id.get()))
.map(|model|&model.transform), .map(|model|&model.transform),
|model|Some(&model.transform) }
)
} }
fn contact_model(&self,model_id:ContactModelId)->&ContactModel{ fn contact_model(&self,model_id:ContactModelId)->&ContactModel{
&self.contact_models[&model_id] &self.contact_models[&model_id]