UNPKG

2d-physics-engine

Version:

A lightweight, flexible 2D physics engine with ECS architecture, built with TypeScript

24 lines 878 B
import { Component } from '../Component.abstract'; export class Collider extends Component { constructor() { super(...arguments); Object.defineProperty(this, "componentId", { enumerable: true, configurable: true, writable: true, value: Symbol('Collider') }); // Optional method for broad phase collision detection // isBoundingBoxColliding(other: Collider): boolean { // const myBox = this.getBoundingBox(); // const otherBox = other.getBoundingBox(); // return !( // myBox.max.x < otherBox.min.x || // myBox.min.x > otherBox.max.x || // myBox.max.y < otherBox.min.y || // myBox.min.y > otherBox.max.y // ); // } } } //# sourceMappingURL=Collider.abstract.js.map