Skip to content

Commit

Permalink
When a KinematicBody is stuck, set the unsafe proportion to the minimum
Browse files Browse the repository at this point in the history
instead of zero. This ensures that collision information is extracted,
in the direction of motion and ensures that a collision is reported.
  • Loading branch information
madmiraal committed May 7, 2020
1 parent 112884d commit 394ae1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion servers/physics_2d/space_2d_sw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion servers/physics_3d/space_3d_sw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 394ae1a

Please sign in to comment.