From 6206f4439d6ca059665e00e0545e7ffb2d8eaf7c Mon Sep 17 00:00:00 2001 From: Cevantime Date: Sat, 27 Jun 2020 15:02:51 +0200 Subject: [PATCH] fix laxist collision detection on one way shapes (cherry picked from commit 23f7d2c29d3f22b06ff3545c6dc3544fbfc5543d) --- servers/physics_2d/body_pair_2d_sw.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp index 38f33134a54..1523d40d1ea 100644 --- a/servers/physics_2d/body_pair_2d_sw.cpp +++ b/servers/physics_2d/body_pair_2d_sw.cpp @@ -264,9 +264,8 @@ bool BodyPair2DSW::setup(real_t p_step) { if (B->get_continuous_collision_detection_mode() == Physics2DServer::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) { @@ -292,9 +291,7 @@ bool BodyPair2DSW::setup(real_t p_step) { if (oneway_disabled) 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;