From b4be1d5e9c250d1065d35d2e522e743b703012b9 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 27 Nov 2023 04:46:20 -0800 Subject: [PATCH] srb2::Mobj: add aabb method, returns standard bounding box --- src/mobj.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mobj.hpp b/src/mobj.hpp index ef64dbce7..da4973606 100644 --- a/src/mobj.hpp +++ b/src/mobj.hpp @@ -13,6 +13,7 @@ #include #include "math/fixed.hpp" +#include "math/line_segment.hpp" #include "math/vec.hpp" #include "doomtype.h" @@ -31,6 +32,7 @@ namespace srb2 struct Mobj : mobj_t { using fixed = math::Fixed; + using line_segment = math::LineSegment; using vec2 = math::Vec2; // TODO: Vec3 would be nice @@ -120,6 +122,10 @@ struct Mobj : mobj_t static void bounce(Mobj* t1, Mobj* t2) { K_KartBouncing(t1, t2); } void solid_bounce(Mobj* solid) { K_KartSolidBounce(this, solid); } + // A = bottom left corner + // this->aabb; the standard bounding box. This is inapproporiate for paper collision! + line_segment aabb() const { return {{x - radius, y - radius}, {x + radius, y + radius}}; } + // // Mobj pointers