diff options
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/bsp_tree.cpp | 2 | ||||
-rw-r--r-- | core/math/rect2.h | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index f155d626d7..7ad907db97 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -341,7 +341,7 @@ static int _bsp_create_node(const Face3 *p_faces, const Vector<int> &p_indices, ERR_FAIL_COND_V(p_nodes.size() == BSP_Tree::MAX_NODES, -1); // should not reach here - ERR_FAIL_COND_V(p_indices.size() == 0, -1) + ERR_FAIL_COND_V(p_indices.size() == 0, -1); int ic = p_indices.size(); const int *indices = p_indices.ptr(); diff --git a/core/math/rect2.h b/core/math/rect2.h index 9017377770..0d2e7eb6e5 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -60,6 +60,19 @@ struct Rect2 { return true; } + inline bool intersects_touch(const Rect2 &p_rect) const { + if (position.x > (p_rect.position.x + p_rect.size.width)) + return false; + if ((position.x + size.width) < p_rect.position.x) + return false; + if (position.y > (p_rect.position.y + p_rect.size.height)) + return false; + if ((position.y + size.height) < p_rect.position.y) + return false; + + return true; + } + inline real_t distance_to(const Vector2 &p_point) const { real_t dist = 0.0; |