diff --git a/engine/physics/src/minimum_difference.rs b/engine/physics/src/minimum_difference.rs index eb6bf7d1..c44b82ca 100644 --- a/engine/physics/src/minimum_difference.rs +++ b/engine/physics/src/minimum_difference.rs @@ -1,6 +1,6 @@ use strafesnet_common::integer::vec3; use strafesnet_common::integer::vec3::Vector3; -use strafesnet_common::integer::{Fixed,Planar64Vec3}; +use strafesnet_common::integer::{Fixed,Planar64,Planar64Vec3}; use crate::model::{DirectedEdge,FEV,MeshQuery,MinkowskiMesh,MinkowskiVert}; @@ -557,7 +557,7 @@ impl ThickPlane{ let normal=(p1-p0).cross(p2-p0); // Allow ~ 2*sqrt(3) units of thickness on the plane // This is to account for the variance of two voxels across the longest diagonal - let epsilon=normal.length().wrap_3()*3; + let epsilon=(normal.length()*(Planar64::EPSILON*3)).wrap_3(); Self{point,normal,epsilon} } } @@ -570,7 +570,7 @@ impl Contains for ThickPlane{ struct ThickLine{ point:Planar64Vec3, dir:Planar64Vec3, - epsilon:Fixed<2,64>, + epsilon:Fixed<4,128>, } impl ThickLine{ fn new(mesh:&MinkowskiMesh,[v0,v1]:Simplex<2>)->Self{ @@ -580,7 +580,7 @@ impl ThickLine{ let dir=p1-p0; // Allow ~ 2*sqrt(3) units of thickness on the plane // This is to account for the variance of two voxels across the longest diagonal - let epsilon=dir.length_squared()*3; + let epsilon=(dir.length_squared()*(Planar64::EPSILON*3)).widen_4(); Self{point,dir,epsilon} } }