diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-07-11 00:26:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-11 00:26:56 +0200 |
commit | d0cea291d2b179610f20fb7136b3e74f26621e92 (patch) | |
tree | 1d2b093f9d2ba8b7289dbcdff57c81bdbb89c603 /servers/physics_2d | |
parent | 21e1ff4bb0bc982f97bf1d21637fe259badb2e22 (diff) | |
parent | 7eebb06b5571437828d8c5099558c303c72cd1f4 (diff) |
Merge pull request #40193 from KoBeWi/dem_pikks
Allow Area2D and 3D mouse events without collision layer
Diffstat (limited to 'servers/physics_2d')
-rw-r--r-- | servers/physics_2d/space_2d_sw.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 966dcbd651..2083caf4c3 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -34,8 +34,9 @@ #include "core/os/os.h" #include "core/pair.h" #include "physics_server_2d_sw.h" -_FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { - if (!(p_object->get_collision_layer() & p_collision_mask)) { + +_FORCE_INLINE_ static bool _can_collide_with(CollisionObject2DSW *p_object, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, bool p_ignore_layers = false) { + if (!p_ignore_layers && !(p_object->get_collision_layer() & p_collision_mask)) { return false; } @@ -64,7 +65,7 @@ int PhysicsDirectSpaceState2DSW::_intersect_point_impl(const Vector2 &p_point, S int cc = 0; for (int i = 0; i < amount; i++) { - if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask, p_collide_with_bodies, p_collide_with_areas)) { + if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask, p_collide_with_bodies, p_collide_with_areas, p_filter_by_canvas)) { continue; } |