Skip to content

Commit

Permalink
Fixed AABOX2D collision
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
steven11sjf committed Mar 13, 2024
1 parent 62f6259 commit f1129fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mercury_engine_data_structures/formats/collision.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -38,9 +38,9 @@

collision_formats = {
"AABOX2D": Struct(
unknown1=UInt,
min=CVector2D,
max=CVector2D,
center=CVector2D,
unk=Float,
size=CVector2D,
),
"CIRCLE": Struct(
value1=Float,
Expand Down

0 comments on commit f1129fb

Please sign in to comment.