summaryrefslogtreecommitdiff
path: root/servers/physics_2d
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2018-05-26 18:29:49 +0200
committerGitHub <noreply@github.com>2018-05-26 18:29:49 +0200
commite790d4aafa0777423194d583ac2bba31ce3d7e2e (patch)
treed4e176c8c9f20d43d014377df97f05c86661d8fe /servers/physics_2d
parent7e8b7a7815788544d9cfacb14e265d10cf832160 (diff)
parent1ba106a71e6c0550ebf95d9563995d0266cfecb1 (diff)
Merge pull request #18349 from Gorgexpress/master
Fixed 2D intersect_shape limiting broadphase results
Diffstat (limited to 'servers/physics_2d')
-rw-r--r--servers/physics_2d/space_2d_sw.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index 503ca0af4a..0e1f74d8d0 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -181,12 +181,15 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans
Rect2 aabb = p_xform.xform(shape->get_aabb());
aabb = aabb.grow(p_margin);
- int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, p_result_max, space->intersection_query_subindex_results);
+ int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
int cc = 0;
for (int i = 0; i < amount; i++) {
+ if (cc >= p_result_max)
+ break;
+
if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask))
continue;