mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-23 22:11:01 +00:00
srb2::Mobj: add aabb method, returns standard bounding box
This commit is contained in:
parent
e88b3c2bdd
commit
b4be1d5e9c
1 changed files with 6 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <optional>
|
||||
|
||||
#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<fixed>;
|
||||
using vec2 = math::Vec2<fixed>;
|
||||
|
||||
// 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue