From d22ceeef1bec083d5e047458e88d97ca091cd1c5 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 17 Sep 2017 10:18:09 -0300 Subject: correction to one way collision code --- servers/physics_2d/space_2d_sw.cpp | 6 +++--- servers/physics_2d/space_2d_sw.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index cbfbb38bc2..8f22d1cd44 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -580,7 +580,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co ExcludedShapeSW esp; esp.local_shape = body_shape; esp.against_object = col_obj; - esp.against_shape = against_shape; + esp.against_shape_index = shape_idx; excluded_shape_pairs[excluded_shape_pair_count++] = esp; } } @@ -649,7 +649,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co for (int k = 0; k < excluded_shape_pair_count; k++) { - if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape == against_shape) { + if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape_index == shape_idx) { excluded = true; break; } @@ -780,7 +780,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co bool excluded = false; for (int k = 0; k < excluded_shape_pair_count; k++) { - if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape == against_shape) { + if (excluded_shape_pairs[k].local_shape == body_shape && excluded_shape_pairs[k].against_object == col_obj && excluded_shape_pairs[k].against_shape_index == shape_idx) { excluded = true; break; } diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index bf60b99f47..c7e7497397 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -74,7 +74,7 @@ private: struct ExcludedShapeSW { Shape2DSW *local_shape; const CollisionObject2DSW *against_object; - Shape2DSW *against_shape; + int against_shape_index; }; uint64_t elapsed_time[ELAPSED_TIME_MAX]; -- cgit v1.2.3