diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 7ae2e9769fd5..33e6cb5f5f47 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -989,7 +989,8 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co if (stuck) { safe = 0; - unsafe = 0; + // Set unsafe to the minimum after eight steps = 1/2^8. + unsafe = 1.0 / (1 << 8); best_shape = body_shape_idx; //sadly it's the best break; } diff --git a/servers/physics_3d/space_3d_sw.cpp b/servers/physics_3d/space_3d_sw.cpp index bd8e89a8f5f6..dea562ce2773 100644 --- a/servers/physics_3d/space_3d_sw.cpp +++ b/servers/physics_3d/space_3d_sw.cpp @@ -900,7 +900,8 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform &p_from, cons if (stuck) { safe = 0; - unsafe = 0; + // Set unsafe to the minimum after eight steps = 1/2^8. + unsafe = 1.0 / (1 << 8); best_shape = j; //sadly it's the best break; }