Improve physics

This commit is contained in:
schmelczerandras 2020-10-03 17:57:16 +02:00
parent c21025caf6
commit 4ad60813c9
33 changed files with 457 additions and 382 deletions

View file

@ -7,6 +7,13 @@ export class BoundingBoxList {
this.boundingBoxes.push(box);
}
public remove(box: BoundingBoxBase) {
this.boundingBoxes.splice(
this.boundingBoxes.findIndex((i) => i === box),
1
);
}
public findIntersecting(box: BoundingBoxBase): Array<BoundingBoxBase> {
return this.boundingBoxes.filter((b) => b.intersects(box));
}