diff --git a/src/model_physics.rs b/src/model_physics.rs index a291e21..553e5b6 100644 --- a/src/model_physics.rs +++ b/src/model_physics.rs @@ -131,6 +131,7 @@ impl EdgePool{ } impl From<&crate::model::IndexedModel> for PhysicsMesh{ fn from(indexed_model:&crate::model::IndexedModel)->Self{ + assert!(indexed_model.unique_pos.len()!=0,"Mesh cannot have 0 vertices"); let verts=indexed_model.unique_pos.iter().map(|v|Vert(v.clone())).collect(); let mut vert_ref_guys=vec![VertRefGuy::default();indexed_model.unique_pos.len()]; let mut edge_pool=EdgePool::default(); @@ -247,8 +248,8 @@ impl TransformedMesh<'_>{ } } fn farthest_vert(&self,dir:Planar64Vec3)->VertId{ - let best_dot=Planar64::MIN; - let best_vert; + let mut best_dot=Planar64::MIN; + let mut best_vert=VertId(0); for (i,vert) in self.mesh.verts.iter().enumerate(){ let p=self.transform.transform_point3(vert.0); let d=dir.dot(p);