From 98e795029bcc404463ed151ff5255a72498bc641 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 13 Aug 2023 16:47:58 -0600 Subject: Create network component and system --- engine/components/BoundingBox.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engine/components/BoundingBox.ts') diff --git a/engine/components/BoundingBox.ts b/engine/components/BoundingBox.ts index 5e21b2f..19967f7 100644 --- a/engine/components/BoundingBox.ts +++ b/engine/components/BoundingBox.ts @@ -47,8 +47,9 @@ export class BoundingBox extends Component { { x: this.dimension.width / 2, y: this.dimension.height / 2 }, { x: this.dimension.width / 2, y: -this.dimension.height / 2 }, ] - .map((vertex) => rotateVector(vertex, this.rotation)) + .map((vertex) => rotateVector(vertex, this.rotation)) // rotate .map((vertex) => { + // translate return { x: vertex.x + this.center.x, y: vertex.y + this.center.y, @@ -56,9 +57,10 @@ export class BoundingBox extends Component { }); } - public getRotationInPiOfUnitCircle() { + public getRotationInPiOfUnitCircle(): number { let rads = this.rotation * (Math.PI / 180); if (rads >= Math.PI) { + // Physics system guarantees rotation \in [0, 360) rads -= Math.PI; } return rads; -- cgit v1.2.3-70-g09d2