diff options
Diffstat (limited to 'engine/components')
-rw-r--r-- | engine/components/BoundingBox.ts | 4 | ||||
-rw-r--r-- | engine/components/Control.ts | 2 | ||||
-rw-r--r-- | engine/components/NetworkUpdateable.ts | 8 |
3 files changed, 6 insertions, 8 deletions
diff --git a/engine/components/BoundingBox.ts b/engine/components/BoundingBox.ts index dbe083e..921feb9 100644 --- a/engine/components/BoundingBox.ts +++ b/engine/components/BoundingBox.ts @@ -15,7 +15,6 @@ export class BoundingBox extends Component { this.rotation = rotation ?? 0; } - // https://en.wikipedia.org/wiki/Hyperplane_separation_theorem public isCollidingWith(box: BoundingBox): boolean { if (this.rotation == 0 && box.rotation == 0) { const thisTopLeft = this.getTopLeft(); @@ -36,6 +35,7 @@ export class BoundingBox extends Component { return true; } + // https://en.wikipedia.org/wiki/Hyperplane_separation_theorem const boxes = [this.getVertices(), box.getVertices()]; for (const poly of boxes) { for (let i = 0; i < poly.length; i++) { @@ -89,6 +89,8 @@ export class BoundingBox extends Component { let rads = this.getRotationInPiOfUnitCircle(); const { width, height } = this.dimension; + if (rads == 0) return this.dimension; + if (rads <= Math.PI / 2) { return { width: Math.abs(height * Math.sin(rads) + width * Math.cos(rads)), diff --git a/engine/components/Control.ts b/engine/components/Control.ts index beec82c..d3987d7 100644 --- a/engine/components/Control.ts +++ b/engine/components/Control.ts @@ -3,6 +3,7 @@ import { Component, ComponentNames, Velocity } from '.'; export class Control extends Component { public controlVelocityComponent: Velocity; public controllableBy: string; + public isControllable: boolean; // computed each update in the input system constructor( controllableBy: string, @@ -12,5 +13,6 @@ export class Control extends Component { this.controllableBy = controllableBy; this.controlVelocityComponent = controlVelocityComponent; + this.isControllable = false; } } diff --git a/engine/components/NetworkUpdateable.ts b/engine/components/NetworkUpdateable.ts index 7fb6d18..014270c 100644 --- a/engine/components/NetworkUpdateable.ts +++ b/engine/components/NetworkUpdateable.ts @@ -1,13 +1,7 @@ import { Component, ComponentNames } from '.'; export class NetworkUpdateable extends Component { - public isPublish: boolean; - public isSubscribe: boolean; - - constructor(isPublish: boolean, isSubscribe: boolean) { + constructor() { super(ComponentNames.NetworkUpdateable); - - this.isPublish = isPublish; - this.isSubscribe = isSubscribe; } } |