From f1129fb97337feb30fefa626d5b02c7c4ec3c233 Mon Sep 17 00:00:00 2001 From: Steven Franklin Date: Wed, 13 Mar 2024 18:29:33 -0500 Subject: [PATCH] Fixed AABOX2D collision - Discovered that the AABOX2D format is not (unk, min, max) but is (center, unk, size) - center is the "center" of the rect as an offset from the actor vPos - size is the (w, h) of the box - unk seems to be 0 in the examples i'm working with - to render the box ( (cx, cy), u, (w, h) ), the coordinates are: - left: vPos.x + cx - w/2 - right: vPos.x + cx + w/2 - top: vPos.y + cy - h/2 - bottom: vPos.y + cy + h/2 --- src/mercury_engine_data_structures/formats/collision.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mercury_engine_data_structures/formats/collision.py b/src/mercury_engine_data_structures/formats/collision.py index c77da0f4..b9db2502 100644 --- a/src/mercury_engine_data_structures/formats/collision.py +++ b/src/mercury_engine_data_structures/formats/collision.py @@ -20,7 +20,7 @@ ) CollisionPolyDread = Struct( num_points=Rebuild(UInt, construct.len_(construct.this.points)), - unk=Float, + unk=Hex(UInt), points=Array(construct.this.num_points, CollisionPoint), loop=Flag, boundings=Array(4, Float), @@ -38,9 +38,9 @@ collision_formats = { "AABOX2D": Struct( - unknown1=UInt, - min=CVector2D, - max=CVector2D, + center=CVector2D, + unk=Float, + size=CVector2D, ), "CIRCLE": Struct( value1=Float,