summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-07-03 12:44:49 +0200
committerGitHub <noreply@github.com>2020-07-03 12:44:49 +0200
commit7af7590790b29ad52d01aea6bd4387392394ea0a (patch)
treeaa70d892b0a7c1763b0749cc8d3b7f1885d71f43
parent9a82c3d6a5bc30ab353a9ad4d9def5ec70dd079c (diff)
parent23f7d2c29d3f22b06ff3545c6dc3544fbfc5543d (diff)
Merge pull request #39880 from Cevantime/fix_laxist_one_way_shapes
Fix laxist collision detection on one way shapes
-rw-r--r--servers/physics_2d/body_pair_2d_sw.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp
index 258979ff22..5997959432 100644
--- a/servers/physics_2d/body_pair_2d_sw.cpp
+++ b/servers/physics_2d/body_pair_2d_sw.cpp
@@ -255,9 +255,8 @@ bool BodyPair2DSW::setup(real_t p_step) {
if (B->get_continuous_collision_detection_mode() == PhysicsServer2D::CCD_MODE_CAST_SHAPE) {
motion_B = B->get_motion();
}
- //faster to set than to check..
- //bool prev_collided=collided;
+ bool prev_collided = collided;
collided = CollisionSolver2DSW::solve(shape_A_ptr, xform_A, motion_A, shape_B_ptr, xform_B, motion_B, _add_contact, this, &sep_axis);
if (!collided) {
@@ -285,8 +284,7 @@ bool BodyPair2DSW::setup(real_t p_step) {
return false;
}
- //if (!prev_collided) {
- {
+ if (!prev_collided) {
if (A->is_shape_set_as_one_way_collision(shape_A)) {
Vector2 direction = xform_A.get_axis(1).normalized();
bool valid = false;