diff --git a/lib/bsp_loader/src/brush.rs b/lib/bsp_loader/src/brush.rs index a7ce6e1..d06c4a8 100644 --- a/lib/bsp_loader/src/brush.rs +++ b/lib/bsp_loader/src/brush.rs @@ -138,7 +138,15 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan loop{ // push point onto vertices // problem: this may push a vertex that does not fit in the fixed point range and is thus meaningless - face.push(intersection.divide().narrow_1().unwrap()); + // + // physics bug 2 originates from vertices being imprecise? + // + // Mask off the most precise 16 bits so that + // when face normals are calculated from + // the remaining 16 fractional bits + // they never exceed 32 bits of precision. + const MASK:Planar64=Planar64::raw(!((1<<16)-1)); + face.push(intersection.divide().narrow_1().unwrap().map(|c|c&MASK)); // we looped back around to face1, we're done! if core::ptr::eq(face1,face2){