From df6e1690e14a6520ce651483f8bfc29cec308166 Mon Sep 17 00:00:00 2001 From: Mefiresu <15063879+Mefiresu@users.noreply.github.com> Date: Thu, 5 Sep 2024 23:21:15 +0200 Subject: [PATCH] CheckObjectCollisionBox: Fix top collision detection Fixes some collision bugs with objects. --- RSDKv5/RSDK/Scene/Collision.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RSDKv5/RSDK/Scene/Collision.cpp b/RSDKv5/RSDK/Scene/Collision.cpp index ca8307ed..d88fcfdf 100644 --- a/RSDKv5/RSDK/Scene/Collision.cpp +++ b/RSDKv5/RSDK/Scene/Collision.cpp @@ -332,7 +332,7 @@ uint8 RSDK::CheckObjectCollisionBox(Entity *thisEntity, Hitbox *thisHitbox, Enti otherHitbox->right--; otherHitbox->bottom++; - if (otherIY <= thisIY + ((thisHitbox->top + thisHitbox->bottom) >> 1)) { + if (otherIY < (thisHitbox->top + thisHitbox->bottom + 2 * thisIY) >> 1) { if (otherIY + otherHitbox->bottom >= thisIY + thisHitbox->top && thisIX + thisHitbox->left < otherIX + otherHitbox->right && thisIX + thisHitbox->right > otherIX + otherHitbox->left) { collisionSideV = C_TOP;