From 12f87bd29d47a07b2a5dd5c8d4511f4bf1b662fe Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 24 Mar 2019 18:58:26 -0500 Subject: [PATCH] chore: matter body aabb --- packages/physics/matter/body.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/physics/matter/body.js b/packages/physics/matter/body.js index eabce0a..d5b2dac 100644 --- a/packages/physics/matter/body.js +++ b/packages/physics/matter/body.js @@ -13,6 +13,16 @@ export class Body extends AbstractBody { this.matterBody = this.constructor.bodyFromShape(shape); } + get aabb() { + const bounds = this.matterBody.bounds; + return [ + bounds.min.x, + bounds.min.y, + bounds.max.x - bounds.min.x, + bounds.max.y - bounds.min.y, + ]; + } + applyForce(force) { MatterBody.applyForce( this.matterBody,