diff --git a/engine/physics/src/minimum_difference.rs b/engine/physics/src/minimum_difference.rs index 0ef37155..cd5adb3b 100644 --- a/engine/physics/src/minimum_difference.rs +++ b/engine/physics/src/minimum_difference.rs @@ -288,9 +288,15 @@ fn reduce_simplex( let uv_p = uv.dot(p); // if pvw/uvw >= 0 and upw/uvw >= 0 and uvp/uvw >= 0 then - // local direction = Vector3.new(0, 0, 0) - // return direction, a0, a1, b0, b1, c0, c1, d0, d1 - // end + // TODO: reduce this + if (pv_w.is_zero()||pv_w.is_negative()^uv_w.is_negative()) + ||(up_w.is_zero()||up_w.is_negative()^uv_w.is_negative()) + ||(uv_p.is_zero()||uv_p.is_negative()^uv_w.is_negative()){ + // origin is contained, this is a positive detection + // local direction = Vector3.new(0, 0, 0) + // return direction, a0, a1, b0, b1, c0, c1, d0, d1 + return (vec3::zero(),simplex); + } // local uvwSign = uvw < 0 and -1 or uvw > 0 and 1 or 0 // local uvDist = uvp*uvwSign/uv.magnitude