Skip to content

Commit

Permalink
CheckObjectCollisionBox: Fix top collision detection
Browse files Browse the repository at this point in the history
Fixes some collision bugs with objects.
  • Loading branch information
Mefiresu committed Sep 5, 2024
1 parent d9a5045 commit df6e169
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion RSDKv5/RSDK/Scene/Collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit df6e169

Please sign in to comment.