From ee4396809c5b557c1c429d4ae7b2c34c34c06e8e Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Tue, 16 Jan 2024 19:32:05 +0100 Subject: [PATCH] [C#] Fix `Encloses` failing on shared upper bound for `AABB` and `Rect2` --- modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs | 6 +++--- modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs index ba4f6cb146d..856c6d22ffa 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs @@ -91,11 +91,11 @@ namespace Godot Vector3 dstMax = with._position + with._size; return srcMin.x <= dstMin.x && - srcMax.x > dstMax.x && + srcMax.x >= dstMax.x && srcMin.y <= dstMin.y && - srcMax.y > dstMax.y && + srcMax.y >= dstMax.y && srcMin.z <= dstMin.z && - srcMax.z > dstMax.z; + srcMax.z >= dstMax.z; } /// diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs index 34863216077..ca85a8e7cce 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs @@ -112,8 +112,8 @@ namespace Godot public bool Encloses(Rect2 b) { return b._position.x >= _position.x && b._position.y >= _position.y && - b._position.x + b._size.x < _position.x + _size.x && - b._position.y + b._size.y < _position.y + _size.y; + b._position.x + b._size.x <= _position.x + _size.x && + b._position.y + b._size.y <= _position.y + _size.y; } ///