diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-13 16:47:58 -0600 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-13 16:47:58 -0600 |
commit | 98e795029bcc404463ed151ff5255a72498bc641 (patch) | |
tree | 48e50d896d00761eae18c89f89e5dd0ef353b660 /engine/components/BoundingBox.ts | |
parent | c6e9baa0009f7cce0f6ff156a3957ef04a8cb684 (diff) | |
download | jumpstorm-98e795029bcc404463ed151ff5255a72498bc641.tar.gz jumpstorm-98e795029bcc404463ed151ff5255a72498bc641.zip |
Create network component and system
Diffstat (limited to 'engine/components/BoundingBox.ts')
-rw-r--r-- | engine/components/BoundingBox.ts | 6 |
1 files changed, 4 insertions, 2 deletions
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; |