chore: matter body aabb

This commit is contained in:
cha0s 2019-03-24 18:58:26 -05:00
parent 3023489d91
commit 12f87bd29d

View File

@ -13,6 +13,16 @@ export class Body extends AbstractBody {
this.matterBody = this.constructor.bodyFromShape(shape); 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) { applyForce(force) {
MatterBody.applyForce( MatterBody.applyForce(
this.matterBody, this.matterBody,